Merge "Delete container show duplicate toast notifications"
This commit is contained in:
commit
41f3bb1ba4
@ -87,7 +87,14 @@
|
|||||||
var innerFunc = promise.catch.calls.argsFor(0)[0];
|
var innerFunc = promise.catch.calls.argsFor(0)[0];
|
||||||
expect(innerFunc).toBeDefined();
|
expect(innerFunc).toBeDefined();
|
||||||
spyOn(toastService, 'add');
|
spyOn(toastService, 'add');
|
||||||
innerFunc({status: 500});
|
var response = {status: 500};
|
||||||
|
if (angular.isDefined(config.throws) && config.throws) {
|
||||||
|
expect(function() {
|
||||||
|
innerFunc(response);
|
||||||
|
}).toThrow(response);
|
||||||
|
} else {
|
||||||
|
innerFunc(response);
|
||||||
|
}
|
||||||
expect(toastService.add).toHaveBeenCalledWith(config.messageType || 'error', config.error);
|
expect(toastService.add).toHaveBeenCalledWith(config.messageType || 'error', config.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@
|
|||||||
} else {
|
} else {
|
||||||
toastService.add('error', gettext('Unable to delete the container.'));
|
toastService.add('error', gettext('Unable to delete the container.'));
|
||||||
}
|
}
|
||||||
|
throw response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@
|
|||||||
method: 'delete',
|
method: 'delete',
|
||||||
path: '/api/swift/containers/spam/metadata/',
|
path: '/api/swift/containers/spam/metadata/',
|
||||||
error: 'Unable to delete the container.',
|
error: 'Unable to delete the container.',
|
||||||
testInput: [ 'spam' ]
|
testInput: [ 'spam' ],
|
||||||
|
throws: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
func: 'setContainerAccess',
|
func: 'setContainerAccess',
|
||||||
@ -205,7 +206,10 @@
|
|||||||
var innerFunc = promise.catch.calls.argsFor(0)[0];
|
var innerFunc = promise.catch.calls.argsFor(0)[0];
|
||||||
// In the case of 409
|
// In the case of 409
|
||||||
var message = 'Unable to delete the container because it is not empty.';
|
var message = 'Unable to delete the container because it is not empty.';
|
||||||
innerFunc({data: message, status: 409});
|
var response = {data: message, status: 409};
|
||||||
|
expect(function() {
|
||||||
|
innerFunc(response);
|
||||||
|
}).toThrow(response);
|
||||||
expect(toastService.add).toHaveBeenCalledWith('error', message);
|
expect(toastService.add).toHaveBeenCalledWith('error', message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user