@@ -8,12 +8,10 @@ import { Experiments } from "@gitpod/gitpod-protocol/lib/experiments/configcat-s
88import * as chai from "chai" ;
99import "mocha" ;
1010import { Container } from "inversify" ;
11- import { createTestContainer , withTestCtx } from "../test/service-testing-container-module" ;
11+ import { createTestContainer } from "../test/service-testing-container-module" ;
1212import { BUILTIN_INSTLLATION_ADMIN_USER_ID , TypeORM , UserDB } from "@gitpod/gitpod-db/lib" ;
1313import { resetDB } from "@gitpod/gitpod-db/lib/test/reset-db" ;
1414import { OrganizationService } from "../orgs/organization-service" ;
15- import { SYSTEM_USER } from "../authorization/authorizer" ;
16- import { UserService } from "./user-service" ;
1715import { Organization , Token , User } from "@gitpod/gitpod-protocol" ;
1816import { TokenService } from "./token-service" ;
1917import { TokenProvider } from "./token-provider" ;
@@ -33,11 +31,9 @@ describe("TokenService", async () => {
3331
3432 let container : Container ;
3533 let tokenService : TokenService ;
36- let userService : UserService ;
3734 let userDB : UserDB ;
3835 let orgService : OrganizationService ;
3936 let org : Organization ;
40- let owner : User ;
4137 let user : User ;
4238
4339 let token : Token ;
@@ -127,23 +123,10 @@ describe("TokenService", async () => {
127123
128124 tokenService = container . get < TokenService > ( TokenService ) ;
129125 userDB = container . get < UserDB > ( UserDB ) ;
130- userService = container . get < UserService > ( UserService ) ;
131126 orgService = container . get < OrganizationService > ( OrganizationService ) ;
132127 org = await orgService . createOrganization ( BUILTIN_INSTLLATION_ADMIN_USER_ID , "myOrg" ) ;
133- const invite = await orgService . getOrCreateInvite ( BUILTIN_INSTLLATION_ADMIN_USER_ID , org . id ) ;
134- // first not builtin user join an org will be an owner
135- owner = await userService . createUser ( {
136- organizationId : org . id ,
137- identity : {
138- authId : "foo" ,
139- authName : "bar" ,
140- authProviderId : "github" ,
141- primaryEmail :
"[email protected] " , 142- } ,
143- } ) ;
144- await withTestCtx ( SYSTEM_USER , ( ) => orgService . joinOrganization ( owner . id , invite . id ) ) ;
145128
146- user = await userService . createUser ( {
129+ user = await orgService . createOrgOwnedUser ( {
147130 organizationId : org . id ,
148131 identity : {
149132 authId : githubUserAuthId ,
@@ -159,7 +142,6 @@ describe("TokenService", async () => {
159142 primaryEmail :
"[email protected] " , 160143 } ) ;
161144 await userDB . storeUser ( user ) ;
162- await withTestCtx ( SYSTEM_USER , ( ) => orgService . joinOrganization ( user . id , invite . id ) ) ;
163145
164146 // test data
165147 token = < Token > {
0 commit comments