mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #702 from sharelatex/ta-rename-remove-endpoint
Rename Affiliation Removal Endpoint
This commit is contained in:
commit
e0f6afcbb4
2 changed files with 7 additions and 6 deletions
|
@ -22,10 +22,10 @@ module.exports = UserAffiliationsManager =
|
|||
|
||||
|
||||
removeAffiliation: (userId, email, callback = (error) ->) ->
|
||||
email = encodeURIComponent(email)
|
||||
makeAffiliationRequest {
|
||||
method: 'DELETE'
|
||||
path: "/api/v2/users/#{userId.toString()}/affiliations/#{email}"
|
||||
method: 'POST'
|
||||
path: "/api/v2/users/#{userId.toString()}/affiliations/remove"
|
||||
body: { email }
|
||||
extraSuccessStatusCodes: [404] # `Not Found` responses are considered successful
|
||||
defaultErrorMessage: "Couldn't remove affiliation"
|
||||
}, callback
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
should = require('chai').should()
|
||||
expect = require('chai').expect
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
assert = require('assert')
|
||||
path = require('path')
|
||||
|
@ -91,10 +92,10 @@ describe "UserAffiliationsManager", ->
|
|||
should.not.exist(err)
|
||||
@request.calledOnce.should.equal true
|
||||
requestOptions = @request.lastCall.args[0]
|
||||
expectedUrl = "v1.url/api/v2/users/#{@stubbedUser._id}/affiliations/"
|
||||
expectedUrl += encodeURIComponent(@newEmail)
|
||||
expectedUrl = "v1.url/api/v2/users/#{@stubbedUser._id}/affiliations/remove"
|
||||
requestOptions.url.should.equal expectedUrl
|
||||
requestOptions.method.should.equal 'DELETE'
|
||||
requestOptions.method.should.equal 'POST'
|
||||
expect(requestOptions.body).to.deep.equal { email: @newEmail }
|
||||
done()
|
||||
|
||||
it 'handle error', (done)->
|
||||
|
|
Loading…
Reference in a new issue