Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
3b7e0bb4
Commit
3b7e0bb4
authored
Apr 13, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed testing using done and done()
parent
53b6059f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
test.js
test/js/spec/test.js
+12
-6
No files found.
test/js/spec/test.js
View file @
3b7e0bb4
...
...
@@ -30,7 +30,6 @@
'url'
:
'http://localhost'
,
'user'
:
'user'
,
'password'
:
'pass'
});
api
.
client
.
options
.
timeout
=
10000
;
api
.
login
(
null
,
function
(
err
){
let
error
=
api
.
handleError
(
err
);
expect
(
error
.
constructor
.
name
).
to
.
equal
(
'Error'
);
...
...
@@ -38,7 +37,7 @@
});
});
it
(
'return error if wrong validation'
,
function
()
{
it
(
'return error if wrong validation'
,
function
(
done
)
{
var
auth_data2
=
JSON
.
parse
(
JSON
.
stringify
(
auth_data
));
auth_data2
.
password
=
'abc'
;
var
api
=
new
ZimbraAdminApi
(
auth_data2
);
...
...
@@ -47,39 +46,46 @@
expect
(
error
.
constructor
.
name
).
to
.
equal
(
'Error'
);
expect
(
error
.
title
).
to
.
equal
(
'Internal Server Error'
);
expect
(
error
.
extra
.
code
).
to
.
equal
(
'account.AUTH_FAILED'
);
done
();
}
api
.
login
(
callback
);
});
it
(
'return token if ok validation'
,
function
()
{
it
(
'return token if ok validation'
,
function
(
done
)
{
var
api
=
new
ZimbraAdminApi
(
auth_data
);
var
callback
=
function
(
err
,
response
)
{
expect
(
api
.
client
.
token
).
to
.
exist
;
done
();
}
api
.
login
(
callback
);
});
it
(
'should get all domains'
,
function
()
{
it
(
'should get all domains'
,
function
(
done
)
{
var
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getAllDomains
(
function
(
err
,
data
){
if
(
err
)
console
.
log
(
err
);
expect
(
data
[
0
].
constructor
.
name
).
to
.
equal
(
'Domain'
);
done
();
});
});
it
(
'should get all accounts'
,
function
()
{
it
(
'should get all accounts'
,
function
(
done
)
{
// var callback = sinon.spy();
var
api
=
new
ZimbraAdminApi
(
auth_data
);
// var proxy = api.getAllAccounts(callback);
api
.
getAllAccounts
(
function
(
err
,
data
){
if
(
err
)
console
.
log
(
err
);
expect
(
data
[
0
].
constructor
.
name
).
to
.
equal
(
'Account'
);
done
();
});
});
it
(
'should get all distribution_lists'
,
function
()
{
it
(
'should get all distribution_lists'
,
function
(
done
)
{
var
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getAllDistributionLists
(
function
(
err
,
data
){
if
(
err
)
console
.
log
(
err
);
expect
(
data
[
0
].
constructor
.
name
).
to
.
equal
(
'DistributionList'
);
done
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment