From 701a803da73eb4c72382f72780ae1f603e2b267d Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 22 May 2018 10:19:47 +0100 Subject: [PATCH] Fix ProjectInvite tests since the user no longer had the features --- .../web/test/acceptance/coffee/ProjectInviteTests.coffee | 7 ++++--- services/web/test/acceptance/coffee/helpers/User.coffee | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/services/web/test/acceptance/coffee/ProjectInviteTests.coffee b/services/web/test/acceptance/coffee/ProjectInviteTests.coffee index b599578738..02598b320f 100644 --- a/services/web/test/acceptance/coffee/ProjectInviteTests.coffee +++ b/services/web/test/acceptance/coffee/ProjectInviteTests.coffee @@ -16,6 +16,7 @@ createInvite = (sendingUser, projectId, email, callback=(err, invite)->) -> privileges: 'readAndWrite' }, (err, response, body) -> return callback(err) if err + expect(response.statusCode).to.equal 200 callback(null, body.invite) createProject = (owner, projectName, callback=(err, projectId, project)->) -> @@ -207,9 +208,9 @@ describe "ProjectInviteTests", -> @email = 'smoketestuser@example.com' @projectName = 'sharing test' Async.series [ - (cb) => @user.login cb - (cb) => @user.logout cb + (cb) => @user.ensureUserExists cb (cb) => @sendingUser.login cb + (cb) => @sendingUser.setFeatures { collaborators: 10 }, cb ], done describe 'creating invites', -> @@ -266,7 +267,7 @@ describe "ProjectInviteTests", -> (cb) => expectInvitesInJoinProjectCount @sendingUser, @projectId, 0, cb ], 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 @inviteTwo = null Async.series [ diff --git a/services/web/test/acceptance/coffee/helpers/User.coffee b/services/web/test/acceptance/coffee/helpers/User.coffee index 7d8e9086d4..a02ab5c42c 100644 --- a/services/web/test/acceptance/coffee/helpers/User.coffee +++ b/services/web/test/acceptance/coffee/helpers/User.coffee @@ -40,6 +40,12 @@ class User @referal_id = user?.referal_id 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) ->) -> @getCsrfToken (error) => return callback(error) if error?