Skip to content

Commit

Permalink
Add missed ModLog and Points models to test loader (#1308)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4645
https://eaflood.atlassian.net/browse/WATER-4635

We recently added two new models connected to two new tables to support managing return requirements and viewing licence history.

- [Add Licence Version Purpose Point model](#1288)
- [Add Mod Log model](#1264)

When we did, though, we forgot to make them available to the acceptance test loader!

Plus, as we are adding them to the test loader, we also need to ensure they are included in the teardown.
  • Loading branch information
Cruikshanks authored Sep 5, 2024
1 parent d0d7442 commit cffbecc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/services/data/load/load.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const LicenceRoleHelper = require('../../../../test/support/helpers/licence-role
const LicenceSupplementaryYearHelper = require('../../../../test/support/helpers/licence-supplementary-year.helper.js')
const LicenceVersionPurposeConditionHelper = require('../../../../test/support/helpers/licence-version-purpose-condition.helper.js')
const LicenceVersionPurposeHelper = require('../../../../test/support/helpers/licence-version-purpose.helper.js')
const LicenceVersionPurposePointHelper = require('../../../../test/support/helpers/licence-version-purpose-point.helper.js')
const LicenceVersionHelper = require('../../../../test/support/helpers/licence-version.helper.js')
const LicenceHelper = require('../../../../test/support/helpers/licence.helper.js')
const ModLogHelper = require('../../../../test/support/helpers/mod-log.helper.js')
const PermitLicenceHelper = require('../../../../test/support/helpers/permit-licence.helper.js')
const ReturnLogHelper = require('../../../../test/support/helpers/return-log.helper.js')
const ReturnRequirementPointHelper = require('../../../../test/support/helpers/return-requirement-point.helper.js')
Expand Down Expand Up @@ -97,8 +99,10 @@ const LOAD_HELPERS = {
LicenceSupplementaryYears: { helper: LicenceSupplementaryYearHelper, test: false },
licenceVersionPurposeConditions: { helper: LicenceVersionPurposeConditionHelper, test: false },
licenceVersionPurposes: { helper: LicenceVersionPurposeHelper, test: true, legacy: { schema: 'water', table: 'licence_version_purposes', id: 'licence_version_purpose_id' } },
licenceVersionPurposePoints: { helper: LicenceVersionPurposePointHelper, test: false },
licenceVersions: { helper: LicenceVersionHelper, test: true, legacy: { schema: 'water', table: 'licence_versions', id: 'licence_version_id' } },
licences: { helper: LicenceHelper, test: true, legacy: { schema: 'water', table: 'licences', id: 'licence_id' } },
modLogs: { helper: ModLogHelper, test: false },
permitLicences: { helper: PermitLicenceHelper, test: false },
returnLogs: { helper: ReturnLogHelper, test: true, legacy: { schema: 'returns', table: 'returns', id: 'return_id' } },
returnRequirementPoints: { helper: ReturnRequirementPointHelper, test: false },
Expand Down
48 changes: 48 additions & 0 deletions app/services/data/tear-down/water-schema.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ async function _deleteAllTestData () {
ALTER TABLE water.charge_versions DISABLE TRIGGER ALL;
ALTER TABLE water.charge_version_workflows DISABLE TRIGGER ALL;
ALTER TABLE water.licence_agreements DISABLE TRIGGER ALL;
ALTER TABLE water.licences DISABLE TRIGGER ALL;
ALTER TABLE water.licence_versions DISABLE TRIGGER ALL;
ALTER TABLE water.licence_version_purposes DISABLE TRIGGER ALL;
ALTER TABLE water.licence_version_purpose_conditions DISABLE TRIGGER ALL;
ALTER TABLE water.return_requirement_purposes DISABLE TRIGGER ALL;
ALTER TABLE water.return_requirement_points DISABLE TRIGGER ALL;
ALTER TABLE water.return_requirements DISABLE TRIGGER ALL;
Expand Down Expand Up @@ -198,6 +202,16 @@ async function _deleteAllTestData () {
AND "rr"."return_version_id" = "rv"."return_version_id"
AND "rv"."licence_id" = "l"."licence_id";
DELETE
FROM
"water"."mod_logs" AS "ml"
USING "water"."return_versions" AS "rv",
"water"."licences" AS "l"
WHERE
"l"."is_test" = TRUE
AND "ml"."return_version_id" = "rv"."return_version_id"
AND "rv"."licence_id" = "l"."licence_id";
DELETE
FROM
"water"."return_versions" AS "rv"
Expand Down Expand Up @@ -226,12 +240,42 @@ async function _deleteAllTestData () {
WHERE
"is_test" = TRUE;
DELETE
FROM
"water"."licence_version_purpose_points" AS "lvpp"
USING "water"."licence_version_purposes" AS "lvp",
"water"."licence_versions" AS "lv",
"water"."licences" AS "l"
WHERE
"l"."is_test" = TRUE
AND "lvpp"."licence_version_purpose_id" = "lvp"."licence_version_purpose_id"
AND "lvp"."licence_version_id" = "lv"."licence_version_id"
AND "lv"."licence_id" = "l"."licence_id";
DELETE
FROM
"water"."licence_version_purposes"
WHERE
"is_test" = TRUE;
DELETE
FROM
"water"."mod_logs" AS "ml"
USING "water"."licence_versions" AS "lv",
"water"."licences" AS "l"
WHERE
"l"."is_test" = TRUE
AND "ml"."licence_version_id" = "lv"."licence_version_id"
AND "lv"."licence_id" = "l"."licence_id";
DELETE
FROM
"water"."mod_logs" AS "ml"
USING "water"."licences" AS "l"
WHERE
"l"."is_test" = TRUE
AND "ml"."licence_id" = "l"."licence_id";
DELETE
FROM
"water"."licence_versions"
Expand Down Expand Up @@ -299,6 +343,10 @@ async function _deleteAllTestData () {
ALTER TABLE water.charge_versions ENABLE TRIGGER ALL;
ALTER TABLE water.charge_version_workflows ENABLE TRIGGER ALL;
ALTER TABLE water.licence_agreements ENABLE TRIGGER ALL;
ALTER TABLE water.licences ENABLE TRIGGER ALL;
ALTER TABLE water.licence_versions ENABLE TRIGGER ALL;
ALTER TABLE water.licence_version_purposes ENABLE TRIGGER ALL;
ALTER TABLE water.licence_version_purpose_conditions ENABLE TRIGGER ALL;
ALTER TABLE water.return_requirement_purposes ENABLE TRIGGER ALL;
ALTER TABLE water.return_requirement_points ENABLE TRIGGER ALL;
ALTER TABLE water.return_requirements ENABLE TRIGGER ALL;
Expand Down

0 comments on commit cffbecc

Please sign in to comment.