Skip to content
Permalink
Browse files

feat(api): Add test for AlarmSummary and reductionKey

  • Loading branch information...
smith-opennms committed Jun 23, 2018
1 parent 3bc5b6e commit 3329cf7200184e9480325daefc88f35b1ce73901
Showing with 542 additions and 0 deletions.
  1. +24 −0 test/dao/AlarmDAO.spec.ts
  2. +464 −0 test/rest/23.0.0/get/api/v2/alarms/8.json
  3. +54 −0 test/rest/MockHTTP23.ts
@@ -23,6 +23,7 @@ import {XmlTransformer} from '../../src/rest/XmlTransformer';

import {MockHTTP19} from '../rest/MockHTTP19';
import {MockHTTP21} from '../rest/MockHTTP21';
import {MockHTTP23} from '../rest/MockHTTP23';

const SERVER_NAME='Demo';
const SERVER_URL='http://demo.opennms.org/opennms/';
@@ -272,5 +273,28 @@ describe('AlarmDAO with v2 API', () => {
return true;
})).resolves.toBeTruthy();
});
});

describe('AlarmDAO with AlarmSummaryDTO', () => {
beforeEach((done) => {
auth = new OnmsAuthConfig(SERVER_USER, SERVER_PASSWORD);
server = new OnmsServer(SERVER_NAME, SERVER_URL, auth);
mockHTTP = new MockHTTP23(server);
opennms = new Client(mockHTTP);
dao = new AlarmDAO(mockHTTP);
Client.getMetadata(server, mockHTTP).then((metadata) => {
server.metadata = metadata;
done();
});
});
it('AlarmDAO.get(8)', () => {
const filter = new Filter();
filter.withOrRestriction(new Restriction('alarm.id', Comparators.EQ, 8));
return dao.find(filter).then((alarms) => {
expect(alarms.length).toEqual(4);
expect(alarms[0].id).toEqual(8);
expect(alarms[0].relatedAlarms.length).toEqual(3);
expect(alarms[0].relatedAlarms[0].reductionKey).toEqual('uei.opennms.org/alarms/trigger:localhost:0.0.0.0:HTTPS_APOOLs');
});
});
});
Oops, something went wrong.

0 comments on commit 3329cf7

Please sign in to comment.
You can’t perform that action at this time.