Merge "Cleanup the toastService in *.spec.js files"
This commit is contained in:
commit
8d58c6f3c4
@ -19,7 +19,7 @@
|
||||
|
||||
describe('Launch Instance Import Key Pair Controller', function() {
|
||||
|
||||
var novaAPI, ctrl, toastService, $q, $rootScope;
|
||||
var novaAPI, ctrl, $q, $rootScope;
|
||||
var data = { data: { name: 'newKeypair', public_key: '' } };
|
||||
var modalInstanceMock = {
|
||||
close: angular.noop,
|
||||
@ -35,7 +35,6 @@
|
||||
ctrl = $controller('LaunchInstanceImportKeyPairController', {
|
||||
$modalInstance: modalInstanceMock
|
||||
});
|
||||
toastService = $injector.get('horizon.framework.widgets.toast.service');
|
||||
$q = _$q_;
|
||||
$rootScope = _$rootScope_;
|
||||
}));
|
||||
@ -54,7 +53,6 @@
|
||||
var deferredSuccess = $q.defer();
|
||||
spyOn(novaAPI, 'createKeypair').and.returnValue(deferredSuccess.promise);
|
||||
spyOn(modalInstanceMock, 'close');
|
||||
spyOn(toastService, 'add').and.callThrough();
|
||||
|
||||
ctrl.submit();
|
||||
|
||||
@ -63,9 +61,6 @@
|
||||
|
||||
expect(novaAPI.createKeypair).toHaveBeenCalled();
|
||||
expect(modalInstanceMock.close).toHaveBeenCalled();
|
||||
expect(toastService.add).toHaveBeenCalledWith(
|
||||
'success',
|
||||
'Successfully imported key pair newKeypair.');
|
||||
});
|
||||
|
||||
it('defines a cancel function', function() {
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
describe('horizon.app.core.images.actions.create-volume.service', function() {
|
||||
|
||||
var service, $scope, toast, events, workflow;
|
||||
var service, $scope, events, workflow;
|
||||
var wizardModalService = {
|
||||
modal: function () {
|
||||
return {
|
||||
@ -72,7 +72,6 @@
|
||||
beforeEach(inject(function($injector, _$rootScope_) {
|
||||
$scope = _$rootScope_.$new();
|
||||
service = $injector.get('horizon.app.core.images.actions.create-volume.service');
|
||||
toast = $injector.get('horizon.framework.widgets.toast.service');
|
||||
events = $injector.get('horizon.app.core.images.events');
|
||||
workflow = $injector.get('horizon.app.core.images.workflows.create-volume.service');
|
||||
}));
|
||||
@ -96,7 +95,6 @@
|
||||
var volume = { name: 'Test', id: '2' };
|
||||
|
||||
spyOn(cinderAPI, 'createVolume').and.callThrough();
|
||||
spyOn(toast, 'add').and.callThrough();
|
||||
spyOn(wizardModalService, 'modal').and.callThrough();
|
||||
|
||||
service.initScope($scope);
|
||||
@ -110,8 +108,6 @@
|
||||
$scope.$apply();
|
||||
|
||||
expect(cinderAPI.createVolume).toHaveBeenCalledWith(volume);
|
||||
expect(toast.add).toHaveBeenCalledWith('success', 'Volume Test was successfully created.');
|
||||
expect(toast.add.calls.count()).toBe(1);
|
||||
});
|
||||
|
||||
it('should destroy volume change watcher on exit', function() {
|
||||
|
@ -54,7 +54,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
var service, events, $scope, toast, deferredModal, deferredCreate, $q;
|
||||
var service, events, $scope, deferredModal, deferredCreate, $q;
|
||||
|
||||
///////////////////////
|
||||
|
||||
@ -72,7 +72,6 @@
|
||||
$scope = _$rootScope_.$new();
|
||||
service = $injector.get('horizon.app.core.images.actions.create.service');
|
||||
events = $injector.get('horizon.app.core.images.events');
|
||||
toast = $injector.get('horizon.framework.widgets.toast.service');
|
||||
$q = _$q_;
|
||||
}));
|
||||
|
||||
@ -104,7 +103,6 @@
|
||||
|
||||
spyOn($scope, '$emit').and.callThrough();
|
||||
spyOn(glanceAPI, 'createImage').and.callThrough();
|
||||
spyOn(toast, 'add').and.callThrough();
|
||||
spyOn(wizardModalService, 'modal').and.callThrough();
|
||||
|
||||
service.initScope($scope);
|
||||
@ -119,7 +117,6 @@
|
||||
|
||||
expect(glanceAPI.createImage).toHaveBeenCalledWith({ name: 'Test',
|
||||
id: '2', prop1: '11', prop3: '3'});
|
||||
expect(toast.add).toHaveBeenCalledWith('success', 'Image Test was successfully created.');
|
||||
});
|
||||
|
||||
it('should raise event even if update meta data fails', function() {
|
||||
@ -136,7 +133,6 @@
|
||||
spyOn(glanceAPI, 'createImage').and.callThrough();
|
||||
spyOn(metadataService, 'editMetadata').and.callFake(failedPromise);
|
||||
spyOn($scope, '$emit').and.callThrough();
|
||||
spyOn(toast, 'add').and.callThrough();
|
||||
|
||||
service.initScope($scope);
|
||||
service.perform();
|
||||
@ -149,8 +145,6 @@
|
||||
var modalArgs = wizardModalService.modal.calls.argsFor(0)[0];
|
||||
modalArgs.submit();
|
||||
$scope.$apply();
|
||||
|
||||
expect(toast.add.calls.count()).toBe(1);
|
||||
});
|
||||
|
||||
it('should destroy the event watchers', function() {
|
||||
@ -160,7 +154,6 @@
|
||||
spyOn(wizardModalService, 'modal').and.callThrough();
|
||||
spyOn(glanceAPI, 'createImage').and.callThrough();
|
||||
spyOn(metadataService, 'editMetadata').and.callThrough();
|
||||
spyOn(toast, 'add').and.callThrough();
|
||||
|
||||
service.initScope($scope);
|
||||
service.perform();
|
||||
@ -175,7 +168,6 @@
|
||||
$scope.$apply();
|
||||
|
||||
expect(glanceAPI.createImage).toHaveBeenCalledWith({});
|
||||
expect(toast.add.calls.count()).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user