From 3c6286a9e9c06c23eecfe922ac807fe7d39e6d00 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sat, 12 Sep 2020 07:38:29 +0900 Subject: [PATCH] Drop the usage of nova extensions in JavaScript code Part of the removal of OPENSTACK_NOVA_EXTENSIONS_BLACKLIST (2/3) References to nova extensions are cleaned up. The logic to fetch nova extension list is finally dropped. Change-Id: If4876634276eff37ab0a18a49e6e97851d41911b --- .../configuration/configuration.html | 38 ++++---- .../launch-instance-model.service.js | 10 +- .../launch-instance-model.service.spec.js | 24 ----- .../launch-instance-workflow.service.js | 9 +- .../launch-instance-workflow.service.spec.js | 12 --- .../hz-if-nova-extensions.directive.js | 76 ---------------- .../hz-if-nova-extensions.directive.spec.js | 89 ------------------ .../extensions.service.spec.js | 2 +- .../nova-extensions.service.js | 55 ----------- .../nova-extensions.service.spec.js | 91 ------------------- .../openstack-service-api/nova.service.js | 28 ------ .../nova.service.spec.js | 10 -- .../app/core/workflow/decorator.service.js | 8 +- .../core/workflow/decorator.service.spec.js | 11 +-- 14 files changed, 26 insertions(+), 437 deletions(-) delete mode 100644 openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js delete mode 100644 openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.spec.js delete mode 100644 openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.js delete mode 100644 openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.spec.js diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/configuration/configuration.html b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/configuration/configuration.html index cae980f807..a9fb915825 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/configuration/configuration.html +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/configuration/configuration.html @@ -11,29 +11,25 @@ rows=8> -
-
- - -
+
+ +
-
-
-
- - -
+
+
+ +
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js index 337558427a..3ddae6ff82 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js @@ -37,7 +37,6 @@ 'horizon.app.core.openstack-service-api.glance', 'horizon.app.core.openstack-service-api.neutron', 'horizon.app.core.openstack-service-api.nova', - 'horizon.app.core.openstack-service-api.novaExtensions', 'horizon.app.core.openstack-service-api.security-group', 'horizon.app.core.openstack-service-api.serviceCatalog', 'horizon.app.core.openstack-service-api.settings', @@ -57,7 +56,6 @@ * @param {Object} glanceAPI * @param {Object} neutronAPI * @param {Object} novaAPI - * @param {Object} novaExtensions * @param {Object} securityGroup * @param {Object} serviceCatalog * @param {Object} settings @@ -81,7 +79,6 @@ glanceAPI, neutronAPI, novaAPI, - novaExtensions, securityGroup, serviceCatalog, settings, @@ -589,9 +586,7 @@ } function onVolumeServiceEnabled() { model.volumeBootable = true; - novaExtensions - .ifNameEnabled('BlockDeviceMappingV2Boot') - .then(onBootToVolumeSupported); + model.allowCreateVolumeFromImage = true; if (!config || !config.disable_volume) { getVolumes().then(resolveVolumes, failVolumes); getAbsoluteLimits().then(resolveAbsoluteLimitsDeferred, resolveAbsoluteLimitsDeferred); @@ -605,9 +600,6 @@ resolveVolumeSnapshots(); } } - function onBootToVolumeSupported() { - model.allowCreateVolumeFromImage = true; - } function getVolumes() { return cinderAPI.getVolumes({status: 'available', bootable: 1}) .then(onGetVolumes); diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js index d3b70cdf44..dea6af7d63 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js @@ -22,7 +22,6 @@ var model, scope, settings, $q, glance, IMAGE, VOLUME, VOLUME_SNAPSHOT, INSTANCE_SNAPSHOT; var cinderEnabled = false; var neutronEnabled = false; - var novaExtensionsEnabled = false; var ifAllowedResolve = true; var novaApi = { @@ -252,20 +251,6 @@ } }); - $provide.value('horizon.app.core.openstack-service-api.novaExtensions', { - ifNameEnabled: function() { - var deferred = $q.defer(); - - if (novaExtensionsEnabled) { - deferred.resolve(); - } else { - deferred.reject(); - } - - return deferred.promise; - } - }); - $provide.value('horizon.app.core.openstack-service-api.settings', { getSetting: function(setting) { var deferred = $q.defer(); @@ -465,15 +450,6 @@ expect(model.volumeSnapshots.length).toBe(2); }); - it('should disable create volume from image if nova extensions disabled', function() { - cinderEnabled = true; - novaExtensionsEnabled = false; - model.initialize(true); - scope.$apply(); - - expect(model.allowCreateVolumeFromImage).toBe(false); - }); - it('should default config_drive to false', function() { model.initialize(true); scope.$apply(); diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.js index 886b287159..0d5f757836 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.js @@ -81,8 +81,7 @@ title: gettext('Key Pair'), templateUrl: basePath + 'keypair/keypair.html', helpUrl: basePath + 'keypair/keypair.help.html', - formName: 'launchInstanceKeypairForm', - novaExtension: 'Keypairs' + formName: 'launchInstanceKeypairForm' }, { id: 'configuration', @@ -97,8 +96,7 @@ templateUrl: basePath + 'server-groups/server-groups.html', helpUrl: basePath + 'server-groups/server-groups.help.html', formName: 'launchInstanceServerGroupsForm', - policy: stepPolicy.serverGroups, - novaExtension: 'ServerGroups' + policy: stepPolicy.serverGroups }, { id: 'hints', @@ -107,8 +105,7 @@ helpUrl: basePath + 'scheduler-hints/scheduler-hints.help.html', formName: 'launchInstanceSchedulerHintsForm', policy: stepPolicy.schedulerHints, - setting: 'LAUNCH_INSTANCE_DEFAULTS.enable_scheduler_hints', - novaExtension: 'SchedulerHints' + setting: 'LAUNCH_INSTANCE_DEFAULTS.enable_scheduler_hints' }, { id: 'metadata', diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.spec.js index 71a78a9746..25dd9bd354 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.spec.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-workflow.service.spec.js @@ -71,26 +71,14 @@ expect(launchInstanceWorkflow.steps[4].requiredServiceTypes).toEqual(['network']); }); - it('has a nova extension the key pair step depends on', function() { - expect(launchInstanceWorkflow.steps[6].novaExtension).toEqual("Keypairs"); - }); - it('has a policy rule for the server groups step', function() { expect(launchInstanceWorkflow.steps[8].policy).toEqual(stepPolicy.serverGroups); }); - it('has a nova extension the server groups step depends on', function() { - expect(launchInstanceWorkflow.steps[8].novaExtension).toEqual("ServerGroups"); - }); - it('has a policy rule for the scheduler hints step', function() { expect(launchInstanceWorkflow.steps[9].policy).toEqual(stepPolicy.schedulerHints); }); - it('has a nova extension the scheduler hints step depends on', function() { - expect(launchInstanceWorkflow.steps[9].novaExtension).toEqual("SchedulerHints"); - }); - }); })(); diff --git a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js b/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js deleted file mode 100644 index c9ad7c80ee..0000000000 --- a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (c) Copyright 2015 Hewlett-Packard Development Company, L.P. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function () { - 'use strict'; - - angular - .module('horizon.app.core.cloud-services') - .directive('hzIfNovaExtensions', hzNovaExtensions); - - hzNovaExtensions.$inject = [ - 'hzPromiseToggleTemplateDirective', - 'horizon.app.core.openstack-service-api.novaExtensions' - ]; - - /** - * @ngdoc directive - * @name hz.api:directive:hzIfNovaExtensions - * @module hz.api - * @description - * - * Add this directive to any element containing content which should - * only be evaluated when the specified nova extensions are enabled by - * the nova servers in the currently selected region. If the nova extensions - * are enabled, the content will be evaluated. Otherwise, the content will - * not be compiled. In addition, the element and everything contained by - * it will be removed completely, leaving a simple HTML comment. - * - * This is evaluated once per page load. In current horizon, this means - * it will get re-evaluated with events like the user opening another panel, - * changing logins, or changing their region. - * - * The hz-if-nova-extensions attribute may be set to a single extension (String) - * or an array of extensions (each one being a String). - * All of the following are examples: - * - * hz-if-nova-extensions='"ConfigDrive"' - * hz-if-nova-extensions='["ConfigDrive"]' - * hz-if-nova-extensions='["ConfigDrive", "DiskConfig"]' - * - * @example - * - * In the below, if the ConfigDrive nova extension is not enabled, then - * the div element with hz-if-nova-extensions and all of the elements inside - * of it will be removed and never evaluated by the angular compiler. - * - ```html -
- -
- ``` - */ - function hzNovaExtensions(hzPromiseToggleTemplateDirective, novaExtensions) { - return angular.extend( - hzPromiseToggleTemplateDirective[0], - { - singlePromiseResolver: novaExtensions.ifNameEnabled, - name: 'hzIfNovaExtensions' - } - ); - } - -})(); diff --git a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.spec.js b/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.spec.js deleted file mode 100644 index 57909e8d0d..0000000000 --- a/openstack_dashboard/static/app/core/cloud-services/hz-if-nova-extensions.directive.spec.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * (c) Copyright 2015 Hewlett-Packard Development Company, L.P. - * Copyright 2015 ThoughtWorks Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function () { - 'use strict'; - - describe('horizon.app.core.cloud-services.hzNovaExtension', function () { - var $compile, $scope, deferred, novaExtensionsAPI; - - var template = [ - '
', - '
', - '
', - '
', - '
', - '
' - ].join(''); - - beforeEach(function() { - novaExtensionsAPI = { - ifNameEnabled: function() { - return deferred.promise; - } - }; - - spyOn(novaExtensionsAPI, 'ifNameEnabled').and.callThrough(); - - module('horizon.app.core.cloud-services'); - module('horizon.framework.util.promise-toggle'); - - module('horizon.app.core.openstack-service-api', function($provide) { - $provide.value( - 'horizon.app.core.openstack-service-api.novaExtensions', novaExtensionsAPI - ); - }); - - inject(function (_$compile_, _$q_, _$rootScope_) { - $compile = _$compile_; - deferred = _$q_.defer(); - $scope = _$rootScope_.$new(); - }); - - }); - - // Please note, this code is primarily intended to verify that the - // directive specifies the correct name and that it uses the settings - // service API. Testing of the variations on inputs being resolved - // are tested in the hz-promise-toggle spec. - it('should evaluate child elements when extension is enabled', function () { - var element = $compile(template)($scope); - - deferred.resolve(); - - expect(element.children().length).toBe(0); - expect(novaExtensionsAPI.ifNameEnabled).toHaveBeenCalledWith('ext_name'); - - $scope.$apply(); - expect(element.children().length).toBe(1); - }); - - it('should not evaluate child elements when extension is NOT enabled', function () { - var element = $compile(template)($scope); - - deferred.reject(); - - expect(element.children().length).toBe(0); - expect(novaExtensionsAPI.ifNameEnabled).toHaveBeenCalledWith('ext_name'); - - $scope.$apply(); - expect(element.children().length).toBe(0); - }); - - }); - -})(); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/extensions.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/extensions.service.spec.js index 4bbbe9b2cf..c991668b4d 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/extensions.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/extensions.service.spec.js @@ -17,7 +17,7 @@ (function() { 'use strict'; - describe("novaExtensions", function() { + describe("extensions", function() { var q = { defer: function() { return { diff --git a/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.js b/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.js deleted file mode 100644 index 25b9ff65bd..0000000000 --- a/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * (c) Copyright 2015 Hewlett-Packard Development Company, L.P. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -(function () { - 'use strict'; - - angular - .module('horizon.app.core.openstack-service-api') - .factory('horizon.app.core.openstack-service-api.novaExtensions', novaExtensionsAPI); - - novaExtensionsAPI.$inject = [ - '$cacheFactory', - 'horizon.app.core.openstack-service-api.extensions', - 'horizon.app.core.openstack-service-api.nova' - ]; - - /** - * @ngdoc service - * @name novaExtensionsAPI - * @param {Object} $cacheFactory - * @param {Object} extensionsAPI - * @param {Object} novaAPI - * @description - * Provides cached access to Nova Extensions with utilities to help - * with asynchronous data loading. The cache may be reset at any time - * by accessing the cache and calling removeAll. The next call to any - * function will retrieve fresh results. - * - * The enabled extensions do not change often, so using cached data will - * speed up results. Even on a local devstack in informal testing, - * this saved between 30 - 100 ms per request. - * @returns {Object} The service - */ - function novaExtensionsAPI($cacheFactory, extensionsAPI, novaAPI) { - return extensionsAPI({ - cacheFactory: $cacheFactory( - 'horizon.app.core.openstack-service-api.novaExtensions', - {capacity: 1} - ), - serviceAPI: novaAPI - }); - } -}()); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.spec.js deleted file mode 100644 index 3959fad68d..0000000000 --- a/openstack_dashboard/static/app/core/openstack-service-api/nova-extensions.service.spec.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (c) Copyright 2015 Hewlett-Packard Development Company, L.P. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -(function() { - 'use strict'; - - describe("novaExtensions", function() { - var factory, q, novaAPI; - - beforeEach(module('horizon.app.core.openstack-service-api')); - - beforeEach(module(function($provide) { - novaAPI = {getExtensions: function() { - return {then: angular.noop}; - }}; - q = {defer: function() { - return {resolve: angular.noop}; - }}; - $provide.value('$cacheFactory', function() { - return "cache"; - }); - $provide.value('$q', q); - $provide.value('horizon.app.core.openstack-service-api.nova', novaAPI); - })); - - beforeEach(inject(function($injector) { - factory = $injector.get('horizon.app.core.openstack-service-api.novaExtensions'); - })); - - it("is defined", function() { - expect(factory).toBeDefined(); - }); - - it("defines .cache", function() { - expect(factory.cache).toBeDefined(); - }); - - it("defines .get", function() { - expect(factory.get).toBeDefined(); - var postAction = {then: angular.noop}; - spyOn(novaAPI, 'getExtensions').and.returnValue(postAction); - spyOn(postAction, 'then'); - factory.get(); - expect(novaAPI.getExtensions).toHaveBeenCalledWith({cache: factory.cache}); - expect(postAction.then).toHaveBeenCalled(); - var func = postAction.then.calls.argsFor(0)[0]; - var testData = {data: {items: [1, 2, 3]}}; - expect(func(testData)).toEqual([1, 2, 3]); - }); - - it("defines .ifNameEnabled", function() { - expect(factory.ifNameEnabled).toBeDefined(); - var postAction = {then: angular.noop}; - var deferred = {reject: angular.noop, resolve: angular.noop}; - spyOn(q, 'defer').and.returnValue(deferred); - spyOn(factory, 'get').and.returnValue(postAction); - spyOn(postAction, 'then'); - factory.ifNameEnabled("desired"); - expect(factory.get).toHaveBeenCalled(); - var func1 = postAction.then.calls.argsFor(0)[0]; - var func2 = postAction.then.calls.argsFor(0)[1]; - spyOn(deferred, 'reject'); - func1(); - expect(deferred.reject).toHaveBeenCalled(); - - spyOn(deferred, 'resolve'); - var extensions = [{name: "desired"}]; - func1(extensions); - expect(deferred.resolve).toHaveBeenCalled(); - - deferred.reject.calls.reset(); - func2(); - expect(deferred.reject).toHaveBeenCalledWith('Cannot get the extension list.'); - }); - - }); - -})(); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.js b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.js index 674cd2f8af..2a154ae048 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.js @@ -65,7 +65,6 @@ hardRebootServer: hardRebootServer, startServer: startServer, stopServer: stopServer, - getExtensions: getExtensions, getFlavors: getFlavors, getFlavor: getFlavor, getFlavorExtraSpecs: getFlavorExtraSpecs, @@ -534,33 +533,6 @@ gettext('Unable to stop the server with id: %(id)s')); } - /** - * @name getExtensions - * @param {Object} config - A configuration object - * @description - * Returns a list of enabled extensions. - * - * The listing result is an object with property "items". Each item is - * an extension. - * @example - * The following is an example response: - * - * { - * "items": [ - * { - * "name": "Multinic" - * } - * ] - * } - * @returns {Object} The list of enable extensions - */ - function getExtensions(config) { - return apiService.get('/api/nova/extensions/', config) - .error(function () { - toastService.add('error', gettext('Unable to retrieve the extensions.')); - }); - } - /** * @name getFlavors * @description diff --git a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js index 956b0823e0..5f30cd6747 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/nova.service.spec.js @@ -328,16 +328,6 @@ "error": "Unable to delete the server group with id 1", "testInput": [1] }, - { - "func": "getExtensions", - "method": "get", - "path": "/api/nova/extensions/", - "data": "config", - "error": "Unable to retrieve the extensions.", - "testInput": [ - "config" - ] - }, { "func": "getFlavors", "method": "get", diff --git a/openstack_dashboard/static/app/core/workflow/decorator.service.js b/openstack_dashboard/static/app/core/workflow/decorator.service.js index b7a8b6c824..2d57c85fa2 100644 --- a/openstack_dashboard/static/app/core/workflow/decorator.service.js +++ b/openstack_dashboard/static/app/core/workflow/decorator.service.js @@ -50,13 +50,12 @@ '$q', 'horizon.app.core.openstack-service-api.serviceCatalog', 'horizon.app.core.openstack-service-api.policy', - 'horizon.app.core.openstack-service-api.settings', - 'horizon.app.core.openstack-service-api.novaExtensions' + 'horizon.app.core.openstack-service-api.settings' ]; ///////////// - function dashboardWorkflowDecorator($q, serviceCatalog, policy, settings, novaExtensions) { + function dashboardWorkflowDecorator($q, serviceCatalog, policy, settings) { return decorator; function decorator(spec) { @@ -82,9 +81,6 @@ if (step.setting) { promises.push(settings.ifEnabled(step.setting, true, true)); } - if (step.novaExtension) { - promises.push(novaExtensions.ifNameEnabled(step.novaExtension)); - } if (promises.length > 0) { step.checkReadiness = function () { return $q.all(promises).then(function() { diff --git a/openstack_dashboard/static/app/core/workflow/decorator.service.spec.js b/openstack_dashboard/static/app/core/workflow/decorator.service.spec.js index 94775d49d2..89f863753a 100644 --- a/openstack_dashboard/static/app/core/workflow/decorator.service.spec.js +++ b/openstack_dashboard/static/app/core/workflow/decorator.service.spec.js @@ -17,14 +17,12 @@ 'use strict'; describe('Workflow Decorator', function () { - var decoratorService, catalogService, policyService, settingsService, $scope, deferred, - novaExtensionsService; + var decoratorService, catalogService, policyService, settingsService, $scope, deferred; var steps = [ { id: '1' }, { id: '2', requiredServiceTypes: ['foo-service'] }, { id: '3', policy: 'foo-policy' }, - { id: '4', setting: 'STEPS.step_4_enabled' }, - { id: '5', novaExtension: 'foo-novaExtension'} + { id: '4', setting: 'STEPS.step_4_enabled' } ]; var spec = { steps: steps }; @@ -40,12 +38,9 @@ catalogService = $injector.get('horizon.app.core.openstack-service-api.serviceCatalog'); policyService = $injector.get('horizon.app.core.openstack-service-api.policy'); settingsService = $injector.get('horizon.app.core.openstack-service-api.settings'); - novaExtensionsService = $injector - .get('horizon.app.core.openstack-service-api.novaExtensions'); spyOn(catalogService, 'ifTypeEnabled').and.returnValue(deferred.promise); spyOn(policyService, 'ifAllowed').and.returnValue(deferred.promise); spyOn(settingsService, 'ifEnabled').and.returnValue(deferred.promise); - spyOn(novaExtensionsService, 'ifNameEnabled').and.returnValue(deferred.promise); })); it('is a function', function() { @@ -63,8 +58,6 @@ expect(policyService.ifAllowed).toHaveBeenCalledWith('foo-policy'); expect(settingsService.ifEnabled.calls.count()).toBe(1); expect(settingsService.ifEnabled).toHaveBeenCalledWith('STEPS.step_4_enabled', true, true); - expect(novaExtensionsService.ifNameEnabled.calls.count()).toBe(1); - expect(novaExtensionsService.ifNameEnabled).toHaveBeenCalledWith('foo-novaExtension'); }); it('step checkReadiness function returns true when promise is resolved', function() {