|
| 1 | +import urljoin from 'url-join'; |
| 2 | +import { permissions } from '../../../bitmovin/account/organizations/permissions'; |
| 3 | + |
| 4 | +import { |
| 5 | + mockGet, |
| 6 | + mockPost, |
| 7 | + mockDelete, |
| 8 | + mockHttp, |
| 9 | + assertItReturnsUnderlyingPromise, |
| 10 | + assertItCallsCorrectUrl, |
| 11 | + testSetup, |
| 12 | +} from '../../assertions'; |
| 13 | + |
| 14 | +import {getConfiguration} from '../../utils'; |
| 15 | + |
| 16 | +let testConfiguration = getConfiguration(); |
| 17 | + |
| 18 | +describe('account', () => { |
| 19 | + beforeEach(testSetup); |
| 20 | + describe('organizations', () => { |
| 21 | + describe('groups', () => { |
| 22 | + describe('permissions', () => { |
| 23 | + const testOrgId = '123'; |
| 24 | + const testGroupId = '123'; |
| 25 | + |
| 26 | + const client = permissions(testConfiguration, testOrgId, testGroupId, mockHttp); |
| 27 | + |
| 28 | + describe('list', () => { |
| 29 | + assertItCallsCorrectUrl('GET', urljoin('/v1/account/organizations', testOrgId, 'groups', testGroupId, 'permissions'), client.list); |
| 30 | + assertItReturnsUnderlyingPromise(mockGet, client.list); |
| 31 | + }); |
| 32 | + |
| 33 | + describe('add', () => { |
| 34 | + assertItCallsCorrectUrl('POST', urljoin('/v1/account/organizations', testOrgId, 'groups', testGroupId, 'permissions'), client.add); |
| 35 | + assertItReturnsUnderlyingPromise(mockPost, client.add); |
| 36 | + }); |
| 37 | + |
| 38 | + describe('permission', () => { |
| 39 | + const testPermissionId = '123'; |
| 40 | + |
| 41 | + describe('details', () => { |
| 42 | + assertItCallsCorrectUrl('GET', urljoin('/v1/account/organizations', testOrgId, 'groups', testGroupId, 'permissions', testPermissionId), |
| 43 | + client(testGroupId).details); |
| 44 | + assertItReturnsUnderlyingPromise(mockGet, client(testOrgId).details); |
| 45 | + }); |
| 46 | + describe('delete', () => { |
| 47 | + assertItCallsCorrectUrl('DELETE', urljoin('/v1/account/organizations', testOrgId, 'groups', testGroupId, 'permissions', testPermissionId), |
| 48 | + client(testGroupId).delete); |
| 49 | + assertItReturnsUnderlyingPromise(mockDelete, client(testOrgId).delete); |
| 50 | + }); |
| 51 | + }); |
| 52 | + }); |
| 53 | + }); |
| 54 | + }); |
| 55 | +}); |
| 56 | + |
0 commit comments