@@ -110,6 +110,14 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
110110 confirmedUser : true ,
111111 tfaEnabled : tfaTrue ,
112112 })
113+
114+ auditorUser := suite .userBuilderWithInput (ctx , & userInput {
115+ email : gofakeit .Username () + "@examples.com" ,
116+ password : validPassword ,
117+ confirmedUser : true ,
118+ tfaEnabled : tfaTrue ,
119+ })
120+
113121 // setup allow context with the client in the context which is required for hooks that run
114122 allowCtx := privacy .DecisionContext (validConfirmedUserRestrictedOrg .UserCtx , privacy .Allow )
115123 allowCtx = ent .NewContext (allowCtx , suite .db )
@@ -129,6 +137,14 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
129137
130138 suite .db .UserSetting .UpdateOneID (ssoMember .UserInfo .Edges .Setting .ID ).SetDefaultOrgID (createdssoOrg .ID ).ExecX (allowCtx )
131139
140+ suite .db .OrgMembership .Create ().SetInput (generated.CreateOrgMembershipInput {
141+ OrganizationID : org .ID ,
142+ UserID : auditorUser .UserInfo .ID ,
143+ Role : & enums .RoleAuditor ,
144+ }).ExecX (testUserCtx )
145+
146+ suite .db .UserSetting .UpdateOneID (auditorUser .UserInfo .Edges .Setting .ID ).SetDefaultOrgID (org .ID ).ExecX (allowCtx )
147+
132148 // update the user settings to have the default org set that is the domain restricted org
133149 suite .db .UserSetting .UpdateOneID (validConfirmedUserRestrictedOrg .UserInfo .Edges .Setting .ID ).
134150 SetDefaultOrgID (org .ID ).ExecX (allowCtx )
@@ -176,6 +192,18 @@ func (suite *HandlerTestSuite) TestLoginHandler() {
176192 models .CatalogTrustCenterModule .String (),
177193 },
178194 },
195+ {
196+ name : "happy path, auditor default org" ,
197+ username : auditorUser .UserInfo .Email ,
198+ password : validPassword ,
199+ expectedStatus : http .StatusOK ,
200+ expectedOrgID : org .ID ,
201+ expectedModules : []interface {}{
202+ models .CatalogBaseModule .String (),
203+ models .CatalogComplianceModule .String (),
204+ models .CatalogTrustCenterModule .String (),
205+ },
206+ },
179207 {
180208 name : "domain restricted org, email not allowed, switch to personal org" ,
181209 username : invalidConfirmedUserRestrictedOrg .UserInfo .Email ,
0 commit comments