Skip to content

Commit 0da931a

Browse files
committed
try to use distinct email
1 parent 8d24712 commit 0da931a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internal/httpserve/handlers/login_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
112112
})
113113

114114
auditorUser := suite.userBuilderWithInput(ctx, &userInput{
115-
email: gofakeit.Username() + "@examples.com",
115+
email: "auditor+" + strings.ToLower(ulids.New().String()) + "@examples.com",
116116
password: validPassword,
117117
confirmedUser: true,
118118
tfaEnabled: tfaTrue,
@@ -129,6 +129,10 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
129129
ctxTargetOrg = privacy.DecisionContext(ctxTargetOrg, privacy.Allow)
130130
testUserCtx := ent.NewContext(ctxTargetOrg, suite.db)
131131

132+
auditorOrgCtx := auth.NewTestContextWithOrgID(validConfirmedUserRestrictedOrg.ID, org.ID)
133+
auditorOrgCtx = privacy.DecisionContext(auditorOrgCtx, privacy.Allow)
134+
auditorOrgCtx = ent.NewContext(auditorOrgCtx, suite.db)
135+
132136
suite.db.OrgMembership.Create().SetInput(generated.CreateOrgMembershipInput{
133137
OrganizationID: createdssoOrg.ID,
134138
UserID: ssoMember.UserInfo.ID,
@@ -141,7 +145,7 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
141145
OrganizationID: org.ID,
142146
UserID: auditorUser.UserInfo.ID,
143147
Role: &enums.RoleAuditor,
144-
}).ExecX(testUserCtx)
148+
}).ExecX(auditorOrgCtx)
145149

146150
suite.db.UserSetting.UpdateOneID(auditorUser.UserInfo.Edges.Setting.ID).SetDefaultOrgID(org.ID).ExecX(allowCtx)
147151

0 commit comments

Comments
 (0)