2017-05-11 15:12:17 +02:00
|
|
|
let mongoose = require("mongoose");
|
|
|
|
let AwardingModel = require('../models/awarding');
|
2017-05-11 18:36:32 +02:00
|
|
|
let urls = require('../config/api-url');
|
2017-05-11 15:12:17 +02:00
|
|
|
let codes = require('../routes/http-codes');
|
|
|
|
|
|
|
|
|
|
|
|
//Require the dev-dependencies
|
|
|
|
let chai = require('chai');
|
|
|
|
let chaiHttp = require('chai-http');
|
|
|
|
let server = require('../server');
|
|
|
|
let should = chai.should();
|
|
|
|
|
|
|
|
chai.use(chaiHttp);
|
|
|
|
//Our parent block
|
|
|
|
describe('Command', () => {
|
|
|
|
beforeEach((done) => { //Before each test we empty the database
|
|
|
|
AwardingModel.remove({}, (err) => {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
/*
|
|
|
|
* Test the /GET awardings
|
|
|
|
*/
|
|
|
|
describe('/POST command to create signature', () => {
|
|
|
|
it('it should not succeed without auth-token provided', (done) => {
|
|
|
|
chai.request(server)
|
|
|
|
.post(urls.cmdCreateSig + "/someId")
|
|
|
|
.send({})
|
|
|
|
.end((err, res) => {
|
|
|
|
res.should.have.status(codes.forbidden);
|
|
|
|
res.body.should.be.a('object');
|
|
|
|
res.body.should.have.property('success').eql(false);
|
|
|
|
res.body.should.have.property('message').eql('No token provided.');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|