pip-webui
Version:
HTML5 UI for LOB applications
55 lines (40 loc) • 1.44 kB
JavaScript
describe('pipRest httpBackend query', function() {
var serverUrl = 'http://alpha.pipservices.net';
var $httpBackend,
requestHandler,
pipRest;
beforeEach(function() {
module('pipRest.State');
inject(function ($injector, _pipRest_) {
pipRest = _pipRest_;
$httpBackend = $injector.get('$httpBackend');
});
});
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('Signin should be return user', function(done) {
requestHandler = $httpBackend.when('POST', serverUrl + '/api/signin')
.respond({name: "Boy", email: 'stas@test.ru' , language: "en", pwd_fail_count: 0, pwd_last_fail: null});
pipRest.signin('').call(
{
email: 'stas@test.ru',
password: '123456'
},
function(result) {
assert.isTrue(true);
assert.isDefined(result);
assert.equal(result.name, 'Boy');
assert.equal(result.email, 'stas@test.ru');
assert.equal(result.pwd_fail_count, 0);
},
function(error) {
assert.isFalse(false);
}
);
$httpBackend.flush();
done();
});
});
;