-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: exposing config endpoint from admin api (#679)
* feat: exposing config endpoint from admin api
- Loading branch information
1 parent
69923e3
commit ad0b83c
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const sinon = require('sinon'); | ||
|
||
const cloudinary = require('../../../../lib/cloudinary'); | ||
const api_http = require("https"); | ||
const ClientRequest = require('_http_client').ClientRequest; | ||
|
||
describe('Admin API - Config', () => { | ||
const mocked = {}; | ||
|
||
beforeEach(function () { | ||
mocked.xhr = sinon.useFakeXMLHttpRequest(); | ||
mocked.write = sinon.spy(ClientRequest.prototype, 'write'); | ||
mocked.request = sinon.spy(api_http, 'request'); | ||
}); | ||
|
||
afterEach(function () { | ||
mocked.request.restore(); | ||
mocked.write.restore(); | ||
mocked.xhr.restore(); | ||
}); | ||
|
||
describe('config', () => { | ||
it('should send a request to config endpoint', () => { | ||
cloudinary.v2.api.config(); | ||
|
||
sinon.assert.calledWith(mocked.request, sinon.match({ | ||
pathname: sinon.match('config'), | ||
method: sinon.match('GET'), | ||
query: sinon.match('') | ||
})); | ||
}); | ||
|
||
it('should send a request to config endpoint with optional parameters', () => { | ||
cloudinary.v2.api.config({ settings: true }); | ||
|
||
sinon.assert.calledWith(mocked.request, sinon.match({ | ||
pathname: sinon.match('config'), | ||
method: sinon.match('GET'), | ||
query: sinon.match('settings=true') | ||
})); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters