168 lines
4.2 KiB
CoffeeScript
168 lines
4.2 KiB
CoffeeScript
expect = require("chai").expect
|
|
request = require('request')
|
|
|
|
lib = require('../lib')
|
|
|
|
config = require('../config')
|
|
|
|
module.exports = ()->
|
|
describe('web',->
|
|
websiteid = -1;
|
|
describe('involve',->
|
|
it('-> not logged in',(done)->
|
|
request({method: 'GET',uri:config.ADDRESS+"/web/involve"},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.not.be.undefined
|
|
expect(body.data).to.be.false
|
|
done()
|
|
)
|
|
)
|
|
it('-> validate',(done)->
|
|
lib.login({username:'test_used',password:'test'},(j,login)->
|
|
request({method: 'GET',uri:config.ADDRESS+"/web/involve",jar:j},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.be.undefined
|
|
expect(body.data).to.be.a("array")
|
|
done()
|
|
)
|
|
)
|
|
)
|
|
)
|
|
describe('website',->
|
|
describe('add',->
|
|
it('-> not logged in',(done)->
|
|
request({method: 'POST',uri:config.ADDRESS+"/web/website"},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.not.be.undefined
|
|
expect(body.data).to.be.false
|
|
done()
|
|
)
|
|
)
|
|
it('-> validate',(done)->
|
|
lib.login({username:'test_used',password:'test'},(j,login)->
|
|
request({method: 'POST',uri:config.ADDRESS+"/web/website",json:{
|
|
name: "Test-Pls-Delete"
|
|
},jar:j},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.be.undefined
|
|
expect(body.data).to.be.true
|
|
done()
|
|
)
|
|
)
|
|
)
|
|
)
|
|
describe('edit',->
|
|
it('-> not logged in',(done)->
|
|
request({method: 'PUT',uri:config.ADDRESS+"/web/website/"+websiteid,json:{
|
|
name: "Test-Pls-Delete2"
|
|
}},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.not.be.undefined
|
|
expect(body.data).to.be.false
|
|
done()
|
|
)
|
|
)
|
|
it('-> not involved',(done)->
|
|
lib.login((j,login)->
|
|
request({method: 'PUT',uri:config.ADDRESS+"/web/website"+websiteid,json:{
|
|
name: "Test-Pls-Delete2"
|
|
},jar:j},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.be.undefined
|
|
expect(body.data).to.be.true
|
|
done()
|
|
)
|
|
)
|
|
)
|
|
it('-> validate',(done)->
|
|
lib.login({username:'test_used',password:'test'},(j,login)->
|
|
request({method: 'PUT',uri:config.ADDRESS+"/web/website"+websiteid,json:{
|
|
name: "Test-Pls-Delete2"
|
|
},jar:j},(err,res,body)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
if(typeof body == "string")
|
|
body = JSON.parse(body)
|
|
expect(body.error).to.be.undefined
|
|
expect(body.data).to.be.true
|
|
done()
|
|
)
|
|
)
|
|
)
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
describe('permissions',->
|
|
describe('add',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
describe('domain',->
|
|
describe('add',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('edit',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
describe('page',->
|
|
describe('add',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('edit',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
describe('menu',->
|
|
describe('add',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('edit',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
describe('media',->
|
|
describe('add',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('edit',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
describe('delete',->
|
|
it('-> try',(done)->done())
|
|
)
|
|
)
|
|
)
|