Skip to content

Commit

Permalink
Merge pull request #674 from numerique-gouv/RDUM-delete-parainage
Browse files Browse the repository at this point in the history
refactor(sponsor): remove middleware/env/routes about authent with sponsor
  • Loading branch information
rdubigny authored Sep 6, 2024
2 parents d3e76ed + 4e8a11a commit f26af54
Show file tree
Hide file tree
Showing 53 changed files with 224 additions and 1,505 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ jobs:
- join_and_moderation
- join_collectivite_territoriale_official_contact_domain
- join_must_confirm
- join_org_with_gouv_fr_domain
- join_org_with_trackdechets_domain
- join_org_with_verified_domain
- join_with_code_sent_to_official_contact_email
- join_with_code_sent_to_official_educ_nat_contact_email
- join_with_official_contact_email
- join_with_sponsorship
- reauthenticate_on_admin_page
- redirect_after_session_expiration
- reset_password
Expand Down
17 changes: 0 additions & 17 deletions assets/css/searchable-select.css

This file was deleted.

16 changes: 0 additions & 16 deletions assets/js/searchable-select.js

This file was deleted.

4 changes: 2 additions & 2 deletions cypress/e2e/activate_totp/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ VALUES
(1, '21340126800130', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(1, 1, false, 'verified_email_domain', 'all_members_notified', true);
(1, 1, false, 'verified_email_domain', true);
4 changes: 2 additions & 2 deletions cypress/e2e/delete_account/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ VALUES
(1, '21340126800130', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(1, 1, false, 'verified_email_domain', 'all_members_notified', true);
(1, 1, false, 'verified_email_domain', true);
6 changes: 3 additions & 3 deletions cypress/e2e/delete_totp/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VALUES
(1, '21340126800130', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(1, 1, false, 'verified_email_domain', 'all_members_notified', true),
(2, 1, false, 'verified_email_domain', 'all_members_notified', true);
(1, 1, false, 'verified_email_domain', true),
(2, 1, false, 'verified_email_domain', true);
1 change: 0 additions & 1 deletion cypress/e2e/join_org_with_gouv_fr_domain/env.conf

This file was deleted.

22 changes: 0 additions & 22 deletions cypress/e2e/join_org_with_gouv_fr_domain/fixtures.sql

This file was deleted.

20 changes: 0 additions & 20 deletions cypress/e2e/join_org_with_gouv_fr_domain/index.cy.ts

This file was deleted.

25 changes: 9 additions & 16 deletions cypress/e2e/join_org_with_verified_domain/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ INSERT INTO users
phone_number, job)
VALUES
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Nouveau', '0123456789', 'Sbire'),
(2, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User1', '0123456789', 'Sbire'),
(3, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User2', '0123456789', 'Sbire'),
(4, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User3', '0123456789', 'Sbire'),
(5, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User4', '0123456789', 'Sbire'),
(6, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User5', '0123456789', 'Sbire'),
(7, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'External', '0123456789', 'Sbire'),
(8, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'NotAuthenticated1', '0123456789', 'Sbire');
(2, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User2', '0123456789', 'Sbire'),
(3, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User3', '0123456789', 'Sbire'),
(4, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User4', '0123456789', 'Sbire'),
(5, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'User5', '0123456789', 'Sbire');

INSERT INTO organizations
(id, siret, created_at, updated_at)
Expand All @@ -28,13 +25,9 @@ VALUES
(3, 'randomain.fr', 'verified', CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(2, 1, false, 'domain', 'all_members_notified', true),
(7, 1, true, 'domain', 'all_members_notified', true),
(8, 1, false, 'domain', null, false),
(2, 2, false, 'domain', 'all_members_notified', true),
(3, 1, false, 'domain', 'all_members_notified', true),
(4, 1, false, 'domain', 'all_members_notified', true),
(5, 1, false, 'domain', 'all_members_notified', true),
(6, 1, false, 'domain', 'all_members_notified', true);
(2, 1, false, 'domain', true),
(3, 1, false, 'domain', true),
(4, 1, false, 'domain', true),
(5, 1, false, 'domain', true);
80 changes: 0 additions & 80 deletions cypress/e2e/join_org_with_verified_domain/index.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//

import { MatchOptionFieldEnum, MatchOptionShouldEnum } from "mailslurp-client";

//

describe("join organizations", () => {
Expand All @@ -11,15 +9,6 @@ describe("join organizations", () => {
mailslurp.inboxController.deleteAllInboxEmails({
inboxId: "c6c64542-5601-43e0-b320-b20da72f6edc",
}),
mailslurp.inboxController.deleteAllInboxEmails({
inboxId: "34c5063f-81c0-4d09-9d0b-a7502f844cdf",
}),
mailslurp.inboxController.deleteAllInboxEmails({
inboxId: "04972db5-2c62-460e-8a88-848317acfe34",
}),
mailslurp.inboxController.deleteAllInboxEmails({
inboxId: "869c78e6-196d-4e95-9662-44d25f801b06",
}),
]),
);
});
Expand Down Expand Up @@ -47,80 +36,11 @@ describe("join organizations", () => {
// Click on the suggested organization
cy.get(".fr-grid-row .fr-col-12:first-child .fr-tile__link").click();

// Click on "Je ne connais aucune des personnes proposées"
cy.get('[href="/users/no-sponsor-found/1"]').click();

// Click on the confirmation button
cy.get('[type="submit"]').contains("Personne ne peut me parrainer").click();

// Click on "continue" on the welcome page
cy.get('[type="submit"]').click();

// Check redirection to home page
cy.contains("Votre compte est créé");

cy.mailslurp()
.then((mailslurp) =>
mailslurp
.waitForMatchingEmails(
// match option does not seem to be used here
{
matches: [
{
field: MatchOptionFieldEnum.SUBJECT,
should: MatchOptionShouldEnum.EQUAL,
value: "Votre organisation sur MonComptePro",
},
],
},
1,
"c6c64542-5601-43e0-b320-b20da72f6edc",
60000,
true,
)
.then(([{ id }]) => mailslurp.getEmail(id)),
)
// assert reception of confirmation email
.then((email) => {
expect(email.body).to.include("Jean USER1");
expect(email.body).to.include("Jean EXTERNAL (externe)");
expect(email.body).to.not.include("Jean NOTAUTHENTICATED1");
});

cy.mailslurp()
.then((mailslurp) =>
mailslurp.waitForLatestEmail(
"34c5063f-81c0-4d09-9d0b-a7502f844cdf",
60000,
true,
),
)
// assert reception of notification email
.then((email) => {
expect(email.body).to.match(
/.*Jean Nouveau.*\(c6c64542-5601-43e0-b320-b20da72f6edc@mailslurp\.com\) a rejoint votre organisation.*Commune de clamart - Mairie.*sur .*MonComptePro/,
);
});

// external users should not be warned for newcomers
cy.mailslurp().then((mailslurp) =>
mailslurp
// note that this method may return empty emails arrays before receiving one.
.getEmails("04972db5-2c62-460e-8a88-848317acfe34")
.then((emails) => {
expect(emails).to.be.empty;
}),
);

// non-authenticated users should not be warned for newcomers
cy.mailslurp().then((mailslurp) =>
mailslurp
// note that this method may return empty emails arrays before receiving one.
.getEmails("869c78e6-196d-4e95-9662-44d25f801b06")
.then((emails) => {
expect(emails).to.be.empty;
}),
);
});

it("join another organisation", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ VALUES
(1, '21340126800130', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(1, 1, false, 'domain', 'all_members_notified', true);
(1, 1, false, 'domain', true);
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ describe("join organizations", () => {
cy.get('[type="submit"]').click();
});

// Click on "Je ne connais aucune des personnes proposées"
cy.get('[href="/users/no-sponsor-found/1"]').click();

// Click on the confirmation button
cy.get('[type="submit"]').contains("Personne ne peut me parrainer").click();

cy.contains("Votre compte est créé");

cy.mailslurp()
.then((mailslurp) =>
mailslurp.waitForLatestEmail(
"26ccc0fa-0dc3-4f12-9335-7bb00282920c",
60000,
true,
),
)
// assert reception of notification email
.then((email) => {
expect(email.body).to.match(
/.*Jean Nouveau.*\(c348a2c3-bf54-4f15-bb12-a2d7047c832f@mailslurp\.com\) a rejoint votre organisation.*Commune de lamalou-les-bains - Mairie.*sur .*MonComptePro/,
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ VALUES
(1, '19750663700010', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

INSERT INTO users_organizations
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted)
(user_id, organization_id, is_external, verification_type, has_been_greeted)
VALUES
(1, 1, false, 'domain', 'all_members_notified', true);
(1, 1, false, 'domain', true);
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,6 @@ describe("join organizations", () => {
cy.get('[type="submit"]').click();
});

// Click on "Je ne connais aucune des personnes proposées"
cy.get('[href="/users/no-sponsor-found/1"]').click();

// Click on the confirmation button
cy.get('[type="submit"]').contains("Personne ne peut me parrainer").click();

cy.contains("Votre compte est créé");

cy.mailslurp()
.then((mailslurp) =>
mailslurp.waitForLatestEmail(
"01714bdb-c5d7-48c9-93ab-73dc78c13609",
60000,
true,
),
)
// assert reception of notification email
.then((email) => {
expect(email.body).to.match(
/.*Jean Nouveau.*\(10efdabd-deb0-4d19-a521-6772ca27acf8@mailslurp\.com\) a rejoint votre organisation.*Lycee general et technologique chaptal.*sur .*MonComptePro/,
);
});
});
});
1 change: 0 additions & 1 deletion cypress/e2e/join_with_sponsorship/env.conf

This file was deleted.

Loading

0 comments on commit f26af54

Please sign in to comment.