3 var mysqldb = require('../mysqldb');
4 var config = require('../config/environment');
6 var util = require('util');
7 var chai = require('chai');
8 var chaiHttp = require('chai-http');
9 var should = chai.should();
13 describe('Voice Contexts', function() {
15 * Test the /POST voice/contexts
17 describe('/POST voice/contexts', function() {
18 it('it should POST one contexts without errors', function(done) {
20 .request(util.format('http://%s:%s/api', config.ip, config.port))
21 .post('/voice/contexts')
27 res.should.have.status(201);
36 * Test the /GET voice/contexts
38 describe('/GET voice/contexts', function() {
39 it('it should GET one voice/contexts without errors', function(done) {
41 .request(util.format('http://%s:%s/api', config.ip, config.port))
42 .get('/voice/contexts')
44 res.body.count.should.equal(1);
45 res.should.have.status(200);
53 * Test the /GET voice/contexts/{id}
55 describe('/GET voice/contexts/1', function() {
56 it('it should GET one contexts with id=1 without errors', function(done) {
58 .request(util.format('http://%s:%s/api', config.ip, config.port))
59 .get('/voice/contexts/1')
61 res.body.id.should.equal(1);
62 res.should.have.status(200);
70 * Test the /PUT voice/contexts/{id}
72 describe('/PUT voice/contexts/1', function() {
73 it('it should PUT one contexts with id=1 without errors', function(done) {
75 .request(util.format('http://%s:%s/api', config.ip, config.port))
76 .put('/voice/contexts/1')
81 res.body.name.should.equal('Name II');
82 res.should.have.status(200);
90 * Test the /DELETE voice/contexts/{id}
92 describe('/DELETE voice/contexts1', function() {
93 it('it should DELETE one contexts with id=1 without errors', function(done) {
95 .request(util.format('http://%s:%s/api', config.ip, config.port))
96 .delete('/voice/contexts/1')
98 res.should.have.status(204);