22 lines
504 B
CoffeeScript
22 lines
504 B
CoffeeScript
expect = require("chai").expect
|
|
request = require('request')
|
|
|
|
config = require('./config')
|
|
|
|
module.exports.login = (args,args2)->
|
|
j = request.jar()
|
|
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)->
|
|
expect(err).to.be.null
|
|
expect(res.statusCode).to.be.equal(200)
|
|
expect(body.data).to.be.true
|
|
call(j,body.session)
|
|
)
|