1- const Promise = require ( 'bluebird' ) ;
21const faker = require ( 'faker' ) ;
32const times = require ( 'lodash/times' ) ;
43const { inspectPromise } = require ( '@makeomatic/deploy' ) ;
5- const jwt = require ( '../../src/utils/jwt' ) ;
64
75async function createMembers ( totalUsers = 1 ) {
86 this . userNames = [ ] ;
@@ -23,29 +21,6 @@ exports.createOrganization = async function (customOpts = {}, totalUsers = 1) {
2321 await createMembers . call ( this , totalUsers ) ;
2422 }
2523
26- await this . users . dispatch ( 'register' , {
27- params : {
28- username : 'v@makeomatic.ru' ,
29- password : '123456' ,
30- audience : 'test' ,
31- metadata : {
32- fine : true ,
33- } ,
34- } ,
35- } ) . catch ( ( ) => null ) ;
36-
37- const [ bearer ] = await Promise . all ( [
38- this . users . dispatch ( 'token.create' , {
39- params : {
40- username : 'v@makeomatic.ru' ,
41- name : 'sample' ,
42- } ,
43- } ) ,
44- jwt . login . call ( this . users , 'v@makeomatic.ru' , 'test' ) ,
45- ] ) ;
46-
47- this . bearerAuthHeaders = { authorization : `Bearer ${ bearer } ` } ;
48-
4924 const params = {
5025 name : faker . company . companyName ( ) ,
5126 metadata : {
@@ -55,8 +30,7 @@ exports.createOrganization = async function (customOpts = {}, totalUsers = 1) {
5530 members : this . userNames . slice ( 0 , totalUsers ) ,
5631 ...customOpts ,
5732 } ;
58- const organization = await this . users
59- . dispatch ( 'organization.create' , { params, headers : this . bearerAuthHeaders } )
33+ const organization = await this . dispatch ( 'users.organization.create' , params )
6034 . reflect ( )
6135 . then ( inspectPromise ( true ) ) ;
6236
0 commit comments