Commit afa573fd authored by Patricio Bruna's avatar Patricio Bruna

Fixed error return when invalid login

parent 436dbd45
...@@ -175,7 +175,7 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -175,7 +175,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.client.auth(auth_object, function (err, response) { this.client.auth(auth_object, function (err, response) {
that.secret = null; that.secret = null;
that.password = null; that.password = null;
if (err) return (callback || that.handleError)(err); if (err) return callback(that.handleError(err));
return (callback || that.handleResponse)(null, response); return (callback || that.handleResponse)(null, response);
}); });
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -82,7 +82,7 @@ export default class ZimbraAdminApi { ...@@ -82,7 +82,7 @@ export default class ZimbraAdminApi {
this.client.auth(auth_object, function(err, response){ this.client.auth(auth_object, function(err, response){
that.secret = null; that.secret = null;
that.password = null; that.password = null;
if (err) return (callback || that.handleError)(err); if (err) return callback(that.handleError(err));
return (callback || that.handleResponse)(null, response); return (callback || that.handleResponse)(null, response);
}); });
} }
......
...@@ -110,6 +110,20 @@ ...@@ -110,6 +110,20 @@
api.login(callback); api.login(callback);
}); });
it('should return Error with wrong Login', function(done){
let auth_obj = {
'url': 'http://zimbra.zboxapp.dev:8000/service/admin/soap',
'user': 'admin@zboxapp.dev',
'password':'12345678910'
}
let api = new ZimbraAdminApi(auth_obj);
api.login(function(err, data){
expect(err.extra.code).to.be.equal("account.AUTH_FAILED");
expect(err.extra.reason).to.match(/authentication failed/);
done();
});
});
it('should return directorySearch with total info', function(done){ it('should return directorySearch with total info', function(done){
let api = new ZimbraAdminApi(auth_data); let api = new ZimbraAdminApi(auth_data);
let query_object = {limit: 10, domain: 'customer.dev', types: "accounts"}; let query_object = {limit: 10, domain: 'customer.dev', types: "accounts"};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment