mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed members connect endpoint returning JSON
refs: https://github.com/TryGhost/Toolbox/issues/245 refs: https://github.com/TryGhost/Team/issues/1360 - As a result of my changes in https://github.com/TryGhost/Ghost/commit/3bd4d098 the members connect endpoint had started returning JSON - This is because the members connect endpoint relied on the old default behaviour of the serializer being to return no response, whereas now it does our default JSON response format - I had written a tool to iterate over all endpoints and ensure that they all had explicit serializers before changing the default behaviour, but it missed this endpoint due to the snake case naming - I have double checked and this was the only missed endpoint, the only other one was member_signin_urls.permissions but that was not a true endpoint and was removed in https://github.com/TryGhost/Ghost/commit/202696382 - Note: the snapshot file for this test was generated from running the test against https://github.com/TryGhost/Ghost/commit/e6b92aed9 - one commit before I added the new default behaviour. - Without the new serializer this test fails on main - With the new serialzier, this test passes again, showing the response format has gone back to what we expect
This commit is contained in:
parent
202696382f
commit
0ef5a5c97a
4 changed files with 53 additions and 0 deletions
|
@ -147,5 +147,9 @@ module.exports = {
|
|||
|
||||
get offers() {
|
||||
return require('./offers');
|
||||
},
|
||||
|
||||
get members_stripe_connect() {
|
||||
return require('./members-stripe-connect');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
all() {
|
||||
// No response
|
||||
return;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Members Stripe Connect API can do auth 1: [body] 1`] = `Object {}`;
|
||||
|
||||
exports[`Members Stripe Connect API can do auth 2: [headers] 1`] = `
|
||||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "289",
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"location": StringMatching /\\^https:\\\\/\\\\/connect\\\\\\.stripe\\\\\\.com\\\\/oauth\\\\/authorize\\\\\\?response_type=code&scope=read_write&client_id=/,
|
||||
"set-cookie": Array [
|
||||
StringMatching /\\^ghost-admin-api-session=/,
|
||||
],
|
||||
"vary": "Origin, Accept, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
25
test/e2e-api/admin/members-stripe-connect.test.js
Normal file
25
test/e2e-api/admin/members-stripe-connect.test.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
||||
const {stringMatching} = matchers;
|
||||
|
||||
describe('Members Stripe Connect API', function () {
|
||||
let agent;
|
||||
|
||||
before(async function () {
|
||||
agent = await agentProvider.getAdminAPIAgent();
|
||||
await fixtureManager.init();
|
||||
await agent.loginAsOwner();
|
||||
});
|
||||
|
||||
it('can do auth', async function () {
|
||||
await agent
|
||||
.get(`members/stripe_connect`)
|
||||
.expectStatus(302)
|
||||
.matchBodySnapshot()
|
||||
.matchHeaderSnapshot({
|
||||
location: stringMatching(/^https:\/\/connect\.stripe\.com\/oauth\/authorize\?response_type=code&scope=read_write&client_id=/),
|
||||
'set-cookie': [
|
||||
stringMatching(/^ghost-admin-api-session=/)
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue