feat: Separate out update-user into set-cron and make-admin debug routes

This commit is contained in:
Blade Barringer
2016-05-15 06:42:12 -05:00
parent 23a9a3e0e4
commit 44c9449913
4 changed files with 82 additions and 42 deletions

View File

@@ -0,0 +1,35 @@
import nconf from 'nconf';
import {
generateUser,
} from '../../../../helpers/api-v3-integration.helper';
describe('POST /debug/make-admin', () => {
let user;
before(async () => {
user = await generateUser();
});
afterEach(() => {
nconf.set('IS_PROD', false);
});
it('makes user an admine', async () => {
await user.post('/debug/make-admin');
await user.sync();
expect(user.contributor.admin).to.eql(true);
});
it('returns error when not in production mode', async () => {
nconf.set('IS_PROD', true);
await expect(user.post('/debug/make-admin'))
.eventually.be.rejected.and.to.deep.equal({
code: 404,
error: 'NotFound',
message: 'Not found.',
});
});
});