sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
warehost-frontend/tests/lib.coffee

22 lines
504 B
CoffeeScript
Raw Normal View History

2016-08-14 14:22:11 +02:00
expect = require("chai").expect
request = require('request')
config = require('./config')
2016-08-24 23:11:57 +02:00
module.exports.login = (args,args2)->
2016-08-14 14:22:11 +02:00
j = request.jar()
2016-08-24 23:11:57 +02:00
login = {
username: config.testdata.username,
password: config.testdata.password
}
call = args
if args2
login = args
call = args2
request({method: 'POST',uri: config.ADDRESS+"/login",json:login,jar:j},(err,res,body)->
2016-08-14 14:22:11 +02:00
expect(err).to.be.null
expect(res.statusCode).to.be.equal(200)
expect(body.data).to.be.true
2016-09-01 22:19:08 +02:00
call(j,body.session)
2016-08-14 14:22:11 +02:00
)