mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Test when the user does not accept the invite
This commit is contained in:
@@ -80,6 +80,26 @@ describe "ProjectInviteTests", ->
|
|||||||
@link = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, @invite)
|
@link = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, @invite)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it 'should not grant access if the user does not accept the invite', (done) ->
|
||||||
|
Async.series(
|
||||||
|
[
|
||||||
|
# go to the invite page
|
||||||
|
(cb) =>
|
||||||
|
followInviteLink @user, @link, (err, response, body) =>
|
||||||
|
expect(err).to.be.oneOf [null, undefined]
|
||||||
|
expect(response.statusCode).to.equal 200
|
||||||
|
expect(body).to.match new RegExp("<title>Project Invite - .*</title>")
|
||||||
|
cb()
|
||||||
|
|
||||||
|
# access the project page
|
||||||
|
(cb) =>
|
||||||
|
@user.openProject @invite.projectId, (err) =>
|
||||||
|
expect(err).to.be.instanceof Error
|
||||||
|
cb()
|
||||||
|
|
||||||
|
], done
|
||||||
|
)
|
||||||
|
|
||||||
it 'should allow the user to accept the invite and access the project', (done) ->
|
it 'should allow the user to accept the invite and access the project', (done) ->
|
||||||
Async.series(
|
Async.series(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -73,7 +73,10 @@ class User
|
|||||||
@request.get {
|
@request.get {
|
||||||
url: "/project/#{project_id}"
|
url: "/project/#{project_id}"
|
||||||
}, (error, response, body) ->
|
}, (error, response, body) ->
|
||||||
return callback(error) if error? or response.statusCode != 200
|
return callback(error) if error?
|
||||||
|
if response.statusCode != 200
|
||||||
|
err = new Error("Non-success response when opening project: #{response.statusCode}")
|
||||||
|
return callback(err)
|
||||||
callback(null)
|
callback(null)
|
||||||
|
|
||||||
addUserToProject: (project_id, email, privileges, callback = (error, user) ->) ->
|
addUserToProject: (project_id, email, privileges, callback = (error, user) ->) ->
|
||||||
|
|||||||
Reference in New Issue
Block a user