Skip to content
Snippets Groups Projects
Commit 6f4e690f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

test refactiored to extract login tests

parent 7dabd798
No related branches found
No related tags found
1 merge request!38Resolve "Annotations: reaction decription"
......@@ -180,19 +180,21 @@ describe('ServerConnector', function() {
});
});
it('login with invalid credentials', function() {
var method = ServerConnector.sendPostRequest;
ServerConnector.sendPostRequest = function() {
return Promise.reject(new NetworkError("xxx", {
statusCode : HttpStatus.FORBIDDEN
}));
};
return ServerConnector.login("blabla", "blablabla").then(function() {
ServerConnector.sendPostRequest = method;
assert.ok(false);
}, function(error) {
ServerConnector.sendPostRequest = method;
assert.ok(error.message.indexOf("credentials") >= 0);
describe('login', function() {
it('try invalid credentials', function() {
var method = ServerConnector.sendPostRequest;
ServerConnector.sendPostRequest = function() {
return Promise.reject(new NetworkError("xxx", {
statusCode : HttpStatus.FORBIDDEN
}));
};
return ServerConnector.login("blabla", "blablabla").then(function() {
ServerConnector.sendPostRequest = method;
assert.ok(false);
}, function(error) {
ServerConnector.sendPostRequest = method;
assert.ok(error.message.indexOf("credentials") >= 0);
});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment