Skip to content

Commit

Permalink
test: add it for group api - OKTA-288652 (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuowu committed Jun 19, 2020
1 parent 20eff9b commit 7e38963
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/it/group-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const expect = require('chai').expect;
const okta = require('../../src');
const models = require('../../src/models');
const Collection = require('../../src/collection');
const utils = require('../utils');
const mockGroup = require('./mocks/group.json');
let orgUrl = process.env.OKTA_CLIENT_ORGURL;

if (process.env.OKTA_USE_MOCK) {
orgUrl = `${orgUrl}/group-app`;
}

const client = new okta.Client({
orgUrl: orgUrl,
token: process.env.OKTA_CLIENT_TOKEN,
requestExecutor: new okta.DefaultRequestExecutor()
});

describe('Group App API', () => {
describe('List assigned applications', () => {
let application;
let group;
let groupAssignment;
beforeEach(async () => {
const mockApplication = utils.getBookmarkApplication();
application = await client.createApplication(mockApplication);
group = await client.createGroup(mockGroup);
groupAssignment = await application.createApplicationGroupAssignment(group.id);
});
afterEach(async () => {
await groupAssignment.delete(application.id);
await application.deactivate();
await application.delete();
await group.delete();
});

it('should return a Collection', async () => {
const applications = await group.listApplications();
expect(applications).to.be.instanceOf(Collection);
});

it('should resolve Application in collection', async () => {
await group.listApplications().each(application => {
expect(application).to.be.instanceOf(models.Application);
});
});
});
});
5 changes: 5 additions & 0 deletions test/it/mocks/group.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"profile": {
"name": "Application delete group"
}
}

0 comments on commit 7e38963

Please sign in to comment.