Skip to content

Commit

Permalink
[TECH] Corriger les seeds Acces d'élèves (PIX-14101) (#10017)
Browse files Browse the repository at this point in the history
Co-authored-by: Emmanuelle Bonnemay <[email protected]>
  • Loading branch information
er-lim and EmmanuelleBonnemay authored Sep 2, 2024
1 parent 14f7a04 commit d3f8918
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions api/db/seeds/data/team-acces/build-sco-organization-learners.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NON_OIDC_IDENTITY_PROVIDERS } from '../../../../src/identity-access-management/domain/constants/identity-providers.js';
import { DEFAULT_PASSWORD } from '../../../constants.js';
import { SCO_ORGANIZATION_ID } from './constants.js';

export function buildScoOrganizationLearners(databaseBuilder) {
Expand All @@ -14,7 +13,7 @@ export function buildScoOrganizationLearners(databaseBuilder) {
}

function _buildScoOrganizationLearnerWithAllConnectionTypes(databaseBuilder) {
const user = databaseBuilder.factory.buildUser({
const user = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Eliza',
lastName: 'Delajungle',
email: '[email protected]',
Expand Down Expand Up @@ -42,7 +41,7 @@ function _buildScoOrganizationLearnerWithAllConnectionTypes(databaseBuilder) {
}

function _buildScoOrganizationLearnerWithUsernameAndMediacentre(databaseBuilder) {
const user = databaseBuilder.factory.buildUser({
const user = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Bob',
lastName: 'Leponge',
email: null,
Expand Down Expand Up @@ -70,14 +69,14 @@ function _buildScoOrganizationLearnerWithUsernameAndMediacentre(databaseBuilder)
}

function _buildScoOrganizationLearnerWithUsernameAndEmail(databaseBuilder) {
const user = databaseBuilder.factory.buildUser({
const user = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Naruto',
lastName: 'Uzumaki',
email: '[email protected]',
username: 'naruto.uzumaki.0303',
});

const organizationLearner = databaseBuilder.factory.buildOrganizationLearner({
databaseBuilder.factory.buildOrganizationLearner({
firstName: user.firstName,
lastName: user.lastName,
birthdate: '2013-03-03',
Expand All @@ -87,18 +86,10 @@ function _buildScoOrganizationLearnerWithUsernameAndEmail(databaseBuilder) {
userId: user.id,
nationalStudentId: '123456789NU',
});

databaseBuilder.factory.buildAuthenticationMethod.withPixAsIdentityProviderAndPassword({
userFirstName: organizationLearner.firstName,
userLastName: organizationLearner.lastName,
password: DEFAULT_PASSWORD,
shouldChangePassword: false,
userId: user.id,
});
}

function _buildScoOrganizationLearnerWithEmailAndMediacentre(databaseBuilder) {
const userWithoutPixAuthenticationMethod = databaseBuilder.factory.buildUser({
const userWithoutPixAuthenticationMethod = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Bart',
lastName: 'Simpson',
email: '[email protected]',
Expand Down Expand Up @@ -144,7 +135,7 @@ function _buildScoOrganizationLearnerWithEmailAndMediacentre(databaseBuilder) {
}

function _buildScoOrganizationLearnerWithEmail(databaseBuilder) {
const user = databaseBuilder.factory.buildUser({
const user = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Hermione',
lastName: 'Granger',
email: '[email protected]',
Expand All @@ -164,7 +155,7 @@ function _buildScoOrganizationLearnerWithEmail(databaseBuilder) {
}

function _buildScoOrganizationLearnerWithUsername(databaseBuilder) {
const user = databaseBuilder.factory.buildUser({
const user = databaseBuilder.factory.buildUser.withRawPassword({
firstName: 'Kirua',
lastName: 'Zoldik',
email: null,
Expand Down

0 comments on commit d3f8918

Please sign in to comment.