Fix ProjectInvite tests since the user no longer had the features

This commit is contained in:
James Allen 2018-05-22 10:19:47 +01:00
parent 1d0be569a6
commit 701a803da7
2 changed files with 10 additions and 3 deletions

View file

@ -16,6 +16,7 @@ createInvite = (sendingUser, projectId, email, callback=(err, invite)->) ->
privileges: 'readAndWrite' privileges: 'readAndWrite'
}, (err, response, body) -> }, (err, response, body) ->
return callback(err) if err return callback(err) if err
expect(response.statusCode).to.equal 200
callback(null, body.invite) callback(null, body.invite)
createProject = (owner, projectName, callback=(err, projectId, project)->) -> createProject = (owner, projectName, callback=(err, projectId, project)->) ->
@ -207,9 +208,9 @@ describe "ProjectInviteTests", ->
@email = 'smoketestuser@example.com' @email = 'smoketestuser@example.com'
@projectName = 'sharing test' @projectName = 'sharing test'
Async.series [ Async.series [
(cb) => @user.login cb (cb) => @user.ensureUserExists cb
(cb) => @user.logout cb
(cb) => @sendingUser.login cb (cb) => @sendingUser.login cb
(cb) => @sendingUser.setFeatures { collaborators: 10 }, cb
], done ], done
describe 'creating invites', -> describe 'creating invites', ->
@ -266,7 +267,7 @@ describe "ProjectInviteTests", ->
(cb) => expectInvitesInJoinProjectCount @sendingUser, @projectId, 0, cb (cb) => expectInvitesInJoinProjectCount @sendingUser, @projectId, 0, cb
], done ], done
it 'should allow the project owner to many invites at once', (done) -> it 'should allow the project owner to create many invites at once', (done) ->
@inviteOne = null @inviteOne = null
@inviteTwo = null @inviteTwo = null
Async.series [ Async.series [

View file

@ -40,6 +40,12 @@ class User
@referal_id = user?.referal_id @referal_id = user?.referal_id
callback(null, @password) callback(null, @password)
setFeatures: (features, callback = (error) ->) ->
update = {}
for key, value of features
update["features.#{key}"] = value
UserModel.update { _id: @id }, update, callback
logout: (callback = (error) ->) -> logout: (callback = (error) ->) ->
@getCsrfToken (error) => @getCsrfToken (error) =>
return callback(error) if error? return callback(error) if error?