test: fix provision test
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
|
||||
const common = require('./common.js');
|
||||
|
||||
const expect = require('expect.js'),
|
||||
const appstore = require('../../appstore.js'),
|
||||
expect = require('expect.js'),
|
||||
nock = require('nock'),
|
||||
superagent = require('../../superagent.js'),
|
||||
timers = require('timers/promises');
|
||||
|
||||
@@ -120,6 +122,18 @@ describe('Provision', function () {
|
||||
});
|
||||
|
||||
describe('Activation', function () {
|
||||
let scope1;
|
||||
before(async function () {
|
||||
scope1 = nock(await appstore.getApiServerOrigin())
|
||||
.post('/api/v1/register_cloudron3', (body) => typeof body.domain === 'string' && typeof body.version === 'string')
|
||||
.times(1000)
|
||||
.reply(201, { cloudronId: '32', cloudronToken: 'xx' });
|
||||
});
|
||||
after(function () {
|
||||
scope1.persist(false);
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
it('device is in first time mode', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/provision/status`);
|
||||
expect(response.status).to.equal(200);
|
||||
@@ -224,7 +238,7 @@ describe('Provision', function () {
|
||||
expect(response.status).to.eql(405); // route unavailable post activation
|
||||
});
|
||||
|
||||
it('seutp fails after activation', async function () {
|
||||
it('setup fails after activation', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/provision/setup`)
|
||||
.send({ domainConfig: { provider: 'noop', domain: DOMAIN, adminFqdn: 'my.' + DOMAIN, config: {}, tlsConfig: { provider: 'fallback' } } })
|
||||
.ok(() => true);
|
||||
|
||||
Reference in New Issue
Block a user