[Launch Instance Fix] Add Security Group Step Unit Tests
This patch adds unit tests for the security group step. These tests are focused around the controller and its related components (no selenium tests or view tests). Change-Id: I14dbc603e3bafdcebcb13b0ef7f77d05a26a2122 Partial-Bug: 1435869
This commit is contained in:
parent
602c46e89f
commit
550d3a821b
@ -1,4 +1,3 @@
|
|||||||
/* jshint globalstrict: true */
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
|
* (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||||
*
|
*
|
||||||
@ -18,6 +17,79 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('Launch Instance Security Groups Step', function() {
|
describe('Launch Instance Security Groups Step', function() {
|
||||||
|
|
||||||
|
describe('LaunchInstanceSecurityGroupsCtrl', function() {
|
||||||
|
var ctrl;
|
||||||
|
|
||||||
|
beforeEach(module('hz.dashboard.launch-instance'));
|
||||||
|
|
||||||
|
beforeEach(inject(function($controller) {
|
||||||
|
var model = {
|
||||||
|
newInstanceSpec: {
|
||||||
|
security_groups: [ 'group 1' ]
|
||||||
|
},
|
||||||
|
securityGroups: [ 'group 1', 'group 2' ]
|
||||||
|
};
|
||||||
|
ctrl = $controller('LaunchInstanceSecurityGroupsCtrl',
|
||||||
|
{ launchInstanceModel: model });
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('contains its general labels', function() {
|
||||||
|
expect(ctrl.label).toBeDefined();
|
||||||
|
expect(Object.keys(ctrl.label).length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('contains its table labels', function() {
|
||||||
|
expect(ctrl.tableData).toBeDefined();
|
||||||
|
expect(Object.keys(ctrl.tableData).length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('sets table data to appropriate scoped items', function() {
|
||||||
|
expect(ctrl.tableData).toBeDefined();
|
||||||
|
expect(Object.keys(ctrl.tableData).length).toBe(4);
|
||||||
|
expect(ctrl.tableData.available).toEqual([ 'group 1', 'group 2' ]);
|
||||||
|
expect(ctrl.tableData.allocated).toEqual([ 'group 1' ]);
|
||||||
|
expect(ctrl.tableData.displayedAvailable).toEqual([]);
|
||||||
|
expect(ctrl.tableData.displayedAllocated).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('defines table details template', function() {
|
||||||
|
expect(ctrl.tableDetails).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('defines table help', function() {
|
||||||
|
expect(ctrl.tableHelp).toBeDefined();
|
||||||
|
expect(Object.keys(ctrl.tableHelp).length).toBe(2);
|
||||||
|
expect(ctrl.tableHelp.noneAllocText).toBeDefined();
|
||||||
|
expect(ctrl.tableHelp.availHelpText).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('allows unlimited allocation', function() {
|
||||||
|
expect(ctrl.tableLimits).toBeDefined();
|
||||||
|
expect(Object.keys(ctrl.tableLimits).length).toBe(1);
|
||||||
|
expect(ctrl.tableLimits.maxAllocation).toBe(-1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('LaunchInstanceSecurityGroupsHelpCtrl', function() {
|
||||||
|
var ctrl;
|
||||||
|
|
||||||
|
beforeEach(module('hz.dashboard.launch-instance'));
|
||||||
|
|
||||||
|
beforeEach(inject(function($controller) {
|
||||||
|
ctrl = $controller('LaunchInstanceSecurityGroupsHelpCtrl');
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('defines the title', function() {
|
||||||
|
expect(ctrl.title).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has paragraphs', function() {
|
||||||
|
expect(ctrl.paragraphs).toBeDefined();
|
||||||
|
expect(ctrl.paragraphs.length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-cookies.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-cookies.js"></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-bootstrap.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-bootstrap.js"></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-sanitize.js"></script>
|
||||||
<script src="{{ STATIC_URL }}horizon/lib/smart-table/smart-table.js"></script>
|
<script src="{{ STATIC_URL }}horizon/lib/angular/smart-table.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* Load angular modules extensions list before we include angular/horizon.js */
|
/* Load angular modules extensions list before we include angular/horizon.js */
|
||||||
|
@ -22,25 +22,29 @@ LAUNCH_INST = "dashboard/launch-instance"
|
|||||||
class ServicesTests(test.JasmineTests):
|
class ServicesTests(test.JasmineTests):
|
||||||
# sources would go here
|
# sources would go here
|
||||||
sources = [
|
sources = [
|
||||||
LAUNCH_INST + "/launch-instance.js",
|
'dashboard/dashboard.module.js',
|
||||||
LAUNCH_INST + "/launch-instance.model.js",
|
'dashboard/workflow/workflow.js',
|
||||||
LAUNCH_INST + 'security-groups/security-groups.js',
|
LAUNCH_INST + '/launch-instance.js',
|
||||||
LAUNCH_INST + 'keypair/keypair.js',
|
LAUNCH_INST + '/launch-instance.model.js',
|
||||||
LAUNCH_INST + "/configuration/configuration.js",
|
LAUNCH_INST + '/security-groups/security-groups.js',
|
||||||
LAUNCH_INST + "/flavor/flavor.js",
|
LAUNCH_INST + '/keypair/keypair.js',
|
||||||
LAUNCH_INST + "/network/network.js",
|
LAUNCH_INST + '/configuration/configuration.js',
|
||||||
LAUNCH_INST + "/source/source.js",
|
LAUNCH_INST + '/flavor/flavor.js',
|
||||||
|
LAUNCH_INST + '/network/network.js',
|
||||||
|
LAUNCH_INST + '/source/source.js',
|
||||||
]
|
]
|
||||||
# spec files would go here
|
# spec files would go here
|
||||||
specs = [
|
specs = [
|
||||||
LAUNCH_INST + "/launch-instance.spec.js",
|
'dashboard/dashboard.module.js',
|
||||||
LAUNCH_INST + "/launch-instance.model.spec.js",
|
'dashboard/workflow/workflow.js',
|
||||||
LAUNCH_INST + 'security-groups/security-groups.spec.js',
|
LAUNCH_INST + '/launch-instance.spec.js',
|
||||||
LAUNCH_INST + 'keypair/keypair.spec.js',
|
LAUNCH_INST + '/launch-instance.model.spec.js',
|
||||||
LAUNCH_INST + "/configuration/configuration.spec.js",
|
LAUNCH_INST + '/security-groups/security-groups.spec.js',
|
||||||
LAUNCH_INST + "/flavor/flavor.spec.js",
|
LAUNCH_INST + '/keypair/keypair.spec.js',
|
||||||
LAUNCH_INST + "/network/network.spec.js",
|
LAUNCH_INST + '/configuration/configuration.spec.js',
|
||||||
LAUNCH_INST + "/source/source.spec.js",
|
LAUNCH_INST + '/flavor/flavor.spec.js',
|
||||||
|
LAUNCH_INST + '/network/network.spec.js',
|
||||||
|
LAUNCH_INST + '/source/source.spec.js',
|
||||||
]
|
]
|
||||||
externalTemplates = [
|
externalTemplates = [
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user