Skip to content

Commit

Permalink
UML-3251 - LPAL-1308
Browse files Browse the repository at this point in the history
* Add cloudwatch_data_protection_policy.tf

* Stub out OS address lookups as AXIS doesn't exist anymore.

* Ensure stubs working as expected with a bit of regexp

* Update tests as stubs produce more data than expected

---------

Co-authored-by: Adam Cooper <[email protected]>
  • Loading branch information
gillettmoj and cooperaj authored Aug 5, 2024
1 parent 051c9fd commit 0f0d7e4
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/DonorHW.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Add donor to Health and Welfare LPA
And I see "postcode-lookup" prepopulated within timeout with "B1 1TF"
And I click element marked "Find UK address"
# casper simply checked for 6 options. PAF was updated to remove some of the addresses from the tested postcode so we check for 3. We may ultimately wish to check the values
Then I can find "address-search-result" with 3 options
Then I can find "address-search-result" with 6 options

# Check error message when donor > 100 years old
When I force fill out
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/DonorPF.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Add donor to Property and Finance LPA
And I see "postcode-lookup" prepopulated within timeout with "B1 1TF"
And I click element marked "Find UK address"
# casper simply checked for 6 options. PAF was updated to remove some of the addresses from the tested postcode so we check for 3. We may ultimately wish to check the values
Then I can find "address-search-result" with 3 options
Then I can find "address-search-result" with 6 options
# casper simply checked for 8 options so we do too, but we may ultimately wish to check the values
And I can find "name-title" with 8 options
When I force fill out
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/LpaTypeHW.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Feature: Health and Welfare LPA starting from the Type page

Background:
Given I ignore application exceptions
And Ordnance Survey postcode lookup responses are stubbed out for good postcode B1 1TF
And Ordnance Survey postcode lookup responses are stubbed out for good postcode NG2 1AR
And I log in as appropriate test user
And If I am on dashboard I visit the type page

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/LpaTypePF.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Feature: Property and Finance LPA starting from the Type page

Background:
Given I ignore application exceptions
And Ordnance Survey postcode lookup responses are stubbed out for good postcode B1 1TF
And Ordnance Survey postcode lookup responses are stubbed out for good postcode NG2 1AR
And I log in as appropriate test user
And If I am on dashboard I visit the type page

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/LpaTypePFClone.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Feature: Clone Property and Finance LPA starting from the Type page

Background:
Given I ignore application exceptions
And Ordnance Survey postcode lookup responses are stubbed out for good postcode B1 1TF
And Ordnance Survey postcode lookup responses are stubbed out for good postcode NG2 1AR
And I set cloned to true
And I log in as second seeded user
Then I am taken to the dashboard page
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/common/stubs_ordnance_survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { Then } = require('@badeball/cypress-cucumber-preprocessor');
Then(
`Ordnance Survey postcode lookup responses are stubbed out for good postcode B1 1TF`,
() => {
cy.intercept('GET', '/address-lookup?postcode=B1+1TF', {
cy.intercept('GET', /\/address-lookup\?postcode=B1(%20|\+)1TF/, {
statusCode: 200,
body: {
isPostcodeValid: true,
Expand Down Expand Up @@ -59,7 +59,7 @@ Then(
Then(
`Ordnance Survey postcode lookup responses are stubbed out for good postcode NG2 1AR`,
() => {
cy.intercept('GET', '/address-lookup?postcode=NG2+1AR', {
cy.intercept('GET', /\/address-lookup\?postcode=NG2(%20|\+)1AR/, {
statusCode: 200,
body: {
isPostcodeValid: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
resource "aws_cloudwatch_log_data_protection_policy" "application_logs" {

log_group_name = aws_cloudwatch_log_group.application_logs.name

policy_document = jsonencode({
Name = "data_protection_${var.environment_name}_application_logs"
Version = "2021-06-01"

"Statement" : [
{
"Sid" : "audit-policy",
"DataIdentifier" : [
"arn:aws:dataprotection::aws:data-identifier/EmailAddress"
],
"Operation" : {
"Audit" : {
"FindingsDestination" : {}
}
}
},
{
"Sid" : "redact-policy",
"DataIdentifier" : [
"arn:aws:dataprotection::aws:data-identifier/EmailAddress"
],
"Operation" : {
"Deidentify" : {
"MaskConfig" : {}
}
}
}
]
})
}

0 comments on commit 0f0d7e4

Please sign in to comment.