Merge "Add javascript tests for create label/network/spec"

This commit is contained in:
Jenkins 2016-10-04 12:32:50 +00:00 committed by Gerrit Code Review
commit ddb27bebb7
3 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/**
* (c) Copyright 2016 NEC Corporation
*
* 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('createClusterTemplateLabelsController tests', function() {
var controller;
beforeEach(module('horizon.dashboard.container-infra.cluster-templates'));
beforeEach(inject(function ($injector) {
controller = $injector.get('$controller');
}));
function createController() {
return controller('createClusterTemplateLabelsController');
}
it('should initialise the controller when created', function() {
var ctrl = createController({});
expect(ctrl).toBeDefined();
});
});
})();

View File

@ -0,0 +1,38 @@
/**
* (c) Copyright 2016 NEC Corporation
*
* 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('createClusterTemplateNetworkController tests', function() {
var controller;
beforeEach(module('horizon.dashboard.container-infra.cluster-templates'));
beforeEach(inject(function ($injector) {
controller = $injector.get('$controller');
}));
function createController() {
return controller('createClusterTemplateNetworkController');
}
it('should initialise the controller when created', function() {
var ctrl = createController({});
expect(ctrl).toBeDefined();
});
});
})();

View File

@ -0,0 +1,51 @@
/**
* (c) Copyright 2016 NEC Corporation
*
* 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('createClusterTemplateSpecController tests', function() {
var controller, glance, nova;
function fakePromise() {
return { success: angular.noop };
}
beforeEach(module('horizon.dashboard.container-infra.cluster-templates'));
beforeEach(inject(function ($injector) {
controller = $injector.get('$controller');
glance = $injector.get('horizon.app.core.openstack-service-api.glance');
nova = $injector.get('horizon.app.core.openstack-service-api.nova');
spyOn(glance, 'getImages').and.callFake(fakePromise);
spyOn(nova, 'getFlavors').and.callFake(fakePromise);
spyOn(nova, 'getKeypairs').and.callFake(fakePromise);
}));
function createController(scope) {
return controller('createClusterTemplateSpecController', {$scope: scope});
}
it('should initialise the controller when created', function() {
var ctrl = createController({});
expect(ctrl.images).toBeDefined();
expect(ctrl.nflavors).toBeDefined();
expect(ctrl.mflavors).toBeDefined();
expect(ctrl.keypairs).toBeDefined();
});
});
})();