Commit dc3b60c4 authored by David Gatica's avatar David Gatica

se agrego la funcion getDistributionListMembership

parent 09950bf3
{
"name": "zimbra-admin-api-js",
"version": "0.3.6",
"version": "0.3.7",
"main": "src/index.js",
"engines": {
"node": ">=6.2"
......
......@@ -348,6 +348,21 @@ class ZimbraAdminApi {
});
}
// query_object takes this
// {limit: INT, offset: INT}
getDistributionListMembership(dl, query_object = {}, callback) {
const request_data = this.buildRequestData('GetDistributionListMembership', callback);
request_data.resource = 'dl';
request_data.parse_response = ResponseParser.allResponse;
// request_data.parse_response = function(data, rq, callback){ return callback(null, data.get()) };
request_data.params.params.dl = {
'by': this.dictionary.byIdOrName(dl),
'_content': dl
};
return this.performRequest(request_data);
};
getDistributionListOwners(distributionList, callback) {
this.getDistributionList(distributionList, (err, dl) => {
if (err) return callback(err);
......
......@@ -831,6 +831,24 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
describe('DistributionList tests', function() {
this.timeout(5000);
it('Should Return the DL membership', function(done){
let api = new ZimbraAdminApi(auth_data);
let dl_name = Date.now() + '@zboxapp.dev';
const attributes = {};
api.createDistributionList(dl_name, attributes, function(err, dl){
if (err) return console.error(err);
api.addDistributionListMember(dl.id, ['abierta@customer.dev'], (err, data) =>{
if (err) return console.error(err);
api.getDistributionListMembership('abierta@customer.dev', {}, function(err, dls){
if (err) return console.error(err);
expect(dls.length).to.be.above(0);
expect(dls[0].constructor.name).to.be.equal('DistributionList');
done();
})
});
});
});
it('should remove DL', function(done){
let resource_name = Date.now() + '@zboxapp.dev';
let resource_attributes = {};
......
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