feat: 🎸 allow session recording deletion (#2132)
* feat: 🎸 allow session recording deletion
This commit is contained in:
1 parent
4db8b8e1e7
commit
786e6130cd
9 files changed
+136
-4
No files matched your search
@@ -5,6 +5,11 @@
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import {
|
||||
STATE_SESSION_RECORDING_AVAILABLE,
|
||||
STATE_SESSION_RECORDING_STARTED,
|
||||
TYPE_SESSION_RECORDING_SSH,
|
||||
} from 'api/models/session-recording';
|
||||
|
||||
module('Unit | Ability | session-recording', function (hooks) {
|
||||
setupTest(hooks);
|
||||
@@ -49,4 +54,36 @@ module('Unit | Ability | session-recording', function (hooks) {
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('can delete a session with proper authorization and in available state', function (assert) {
|
||||
const recordingNotinAvaialableState = store.createRecord(
|
||||
'session-recording',
|
||||
{
|
||||
authorized_actions: ['delete'],
|
||||
type: TYPE_SESSION_RECORDING_SSH,
|
||||
state: STATE_SESSION_RECORDING_STARTED,
|
||||
},
|
||||
);
|
||||
const recordingInAvailableState = store.createRecord('session-recording', {
|
||||
authorized_actions: ['delete'],
|
||||
type: TYPE_SESSION_RECORDING_SSH,
|
||||
state: STATE_SESSION_RECORDING_AVAILABLE,
|
||||
});
|
||||
assert.false(
|
||||
canService.can('delete session-recording', recordingNotinAvaialableState),
|
||||
);
|
||||
assert.true(
|
||||
canService.can('delete session-recording', recordingInAvailableState),
|
||||
);
|
||||
});
|
||||
|
||||
test('can re-apply Storage policy with proper authorization', function (assert) {
|
||||
const recording = store.createRecord('session', {
|
||||
authorized_actions: ['reapply-storage-policy'],
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('reapplyStoragePolicy session-recording', recording),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user