move appstore urls into appstore.js
This commit is contained in:
@@ -27,7 +27,7 @@ describe('Appstore Apps API', function () {
|
||||
});
|
||||
|
||||
it('cannot get app with bad token', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get(`/api/v1/apps/org.wordpress.cloudronapp?accessToken=${appstoreToken}`)
|
||||
.reply(403, {});
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('Appstore Apps API', function () {
|
||||
});
|
||||
|
||||
it('can list apps', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get(`/api/v1/apps?accessToken=${appstoreToken}&boxVersion=${constants.VERSION}&unstable=true`, () => true)
|
||||
.reply(200, { apps: [] });
|
||||
|
||||
@@ -52,7 +52,7 @@ describe('Appstore Apps API', function () {
|
||||
});
|
||||
|
||||
it('can get app', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get(`/api/v1/apps/org.wordpress.cloudronapp?accessToken=${appstoreToken}`, () => true)
|
||||
.reply(200, { apps: [] });
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('Appstore Apps API', function () {
|
||||
});
|
||||
|
||||
it('can get app version', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get(`/api/v1/apps/org.wordpress.cloudronapp/versions/3.4.2?accessToken=${appstoreToken}`, () => true)
|
||||
.reply(200, { apps: [] });
|
||||
|
||||
@@ -84,15 +84,15 @@ describe('Appstore Cloudron Registration API - existing user', function () {
|
||||
after(cleanup);
|
||||
|
||||
it('can setup subscription', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/register_user', (body) => body.email && body.password && body.utmSource)
|
||||
.reply(201, {});
|
||||
|
||||
const scope2 = nock(settings.apiServerOrigin())
|
||||
const scope2 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/login', (body) => body.email && body.password)
|
||||
.reply(200, { userId: 'userId', accessToken: 'SECRET_TOKEN' });
|
||||
|
||||
const scope3 = nock(settings.apiServerOrigin())
|
||||
const scope3 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/register_cloudron', (body) => !!body.domain && body.accessToken === 'SECRET_TOKEN')
|
||||
.reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN' });
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('Appstore Cloudron Registration API - existing user', function () {
|
||||
});
|
||||
|
||||
it('can get subscription', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get('/api/v1/subscription?accessToken=CLOUDRON_TOKEN', () => true)
|
||||
.reply(200, { subscription: { plan: { id: 'free' } }, email: 'test@cloudron.io' });
|
||||
|
||||
@@ -133,15 +133,15 @@ describe('Appstore Cloudron Registration API - new user signup', function () {
|
||||
after(cleanup);
|
||||
|
||||
it('can setup subscription', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/register_user', (body) => body.email && body.password && body.utmSource)
|
||||
.reply(201, {});
|
||||
|
||||
const scope2 = nock(settings.apiServerOrigin())
|
||||
const scope2 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/login', (body) => body.email && body.password)
|
||||
.reply(200, { userId: 'userId', accessToken: 'SECRET_TOKEN' });
|
||||
|
||||
const scope3 = nock(settings.apiServerOrigin())
|
||||
const scope3 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/register_cloudron', (body) => !!body.domain && body.accessToken === 'SECRET_TOKEN')
|
||||
.reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN' });
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('Appstore Cloudron Registration API - new user signup', function () {
|
||||
});
|
||||
|
||||
it('can get subscription', async function () {
|
||||
const scope1 = nock(settings.apiServerOrigin())
|
||||
const scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.get('/api/v1/subscription?accessToken=CLOUDRON_TOKEN', () => true)
|
||||
.reply(200, { subscription: { plan: { id: 'free' } }, email: 'test@cloudron.io' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user