mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 08:55:43 +03:00
Add an acceptance test exercising errors from an HTTP response to a notification
This commit is contained in:
@@ -223,7 +223,7 @@ module('Acceptance | task detail', function(hooks) {
|
||||
);
|
||||
});
|
||||
|
||||
test('when task restart fails, an error message is shown', async function(assert) {
|
||||
test('when task restart fails (403), an ACL permissions error message is shown', async function(assert) {
|
||||
server.pretender.put('/v1/client/allocation/:id/restart', () => [403, {}, '']);
|
||||
|
||||
await Task.restart.idle();
|
||||
@@ -241,6 +241,22 @@ module('Acceptance | task detail', function(hooks) {
|
||||
assert.notOk(Task.inlineError.isShown, 'Inline error is no longer shown');
|
||||
});
|
||||
|
||||
test('when task restart fails (500), the error message from the API is piped through to the alert', async function(assert) {
|
||||
const message = 'A plaintext error message';
|
||||
server.pretender.put('/v1/client/allocation/:id/restart', () => [500, {}, message]);
|
||||
|
||||
await Task.restart.idle();
|
||||
await Task.restart.confirm();
|
||||
|
||||
assert.ok(Task.inlineError.isShown);
|
||||
assert.ok(Task.inlineError.title.includes('Could Not Restart Task'));
|
||||
assert.equal(Task.inlineError.message, message);
|
||||
|
||||
await Task.inlineError.dismiss();
|
||||
|
||||
assert.notOk(Task.inlineError.isShown);
|
||||
});
|
||||
|
||||
test('exec button is present', async function(assert) {
|
||||
assert.ok(Task.execButton.isPresent);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user