|
@@ -18,57 +18,46 @@
|
|
|
|
|
|
|
|
|
|
var App = require('app');
|
|
var App = require('app');
|
|
-require('controllers/main/admin/security/add/step3');
|
|
|
|
|
|
+require('controllers/main/admin/security/add/step4');
|
|
require('utils/polling');
|
|
require('utils/polling');
|
|
require('models/cluster_states');
|
|
require('models/cluster_states');
|
|
|
|
|
|
-describe('App.MainAdminSecurityAddStep3Controller', function () {
|
|
|
|
|
|
+describe('App.MainAdminSecurityAddStep4Controller', function () {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Test object
|
|
* Test object
|
|
*/
|
|
*/
|
|
- var controller = App.MainAdminSecurityAddStep3Controller.create();
|
|
|
|
-
|
|
|
|
|
|
+ var controller = App.MainAdminSecurityAddStep4Controller.create();
|
|
|
|
|
|
describe('#moveToNextStage()', function () {
|
|
describe('#moveToNextStage()', function () {
|
|
controller.reopen({
|
|
controller.reopen({
|
|
- startStage: function(){},
|
|
|
|
- saveStages: function(){}
|
|
|
|
|
|
+ saveStages: function(){},
|
|
|
|
+ enableSubmit: function(){},
|
|
|
|
+ loadClusterConfigs: function(){}
|
|
});
|
|
});
|
|
App.clusterStatus.reopen({
|
|
App.clusterStatus.reopen({
|
|
setClusterStatus: function(){}
|
|
setClusterStatus: function(){}
|
|
});
|
|
});
|
|
|
|
|
|
- it('first stage is started', function(){
|
|
|
|
- controller.set('stages', [
|
|
|
|
- App.Poll.create({stage: 'stage1', isStarted: false, isCompleted: false}),
|
|
|
|
- App.Poll.create({stage: 'stage2', isStarted: false, isCompleted: false}),
|
|
|
|
- App.Poll.create({stage: 'stage3', isStarted: false, isCompleted: false})
|
|
|
|
- ]);
|
|
|
|
- controller.moveToNextStage();
|
|
|
|
-
|
|
|
|
- expect(controller.get('stages').findProperty('stage', 'stage1').get('isStarted')).to.equal(true);
|
|
|
|
- });
|
|
|
|
- it('second stage is started', function(){
|
|
|
|
- controller.set('stages', [
|
|
|
|
- App.Poll.create({stage: 'stage1', isStarted: true, isCompleted: true}),
|
|
|
|
- App.Poll.create({stage: 'stage2', isStarted: false, isCompleted: false}),
|
|
|
|
- App.Poll.create({stage: 'stage3', isStarted: false, isCompleted: false})
|
|
|
|
- ]);
|
|
|
|
- controller.moveToNextStage();
|
|
|
|
|
|
+ controller.set('stages', [
|
|
|
|
+ App.Poll.create({stage: 'stage2', isStarted: false, isPolling: true, isCompleted: false, start: function(){}}),
|
|
|
|
+ App.Poll.create({stage: 'stage3', isStarted: false, isPolling: false, isCompleted: false, start: function(){}}),
|
|
|
|
+ App.Poll.create({stage: 'stage4', isStarted: false, isPolling: true, isCompleted: false, start: function(){}})
|
|
|
|
+ ]);
|
|
|
|
|
|
|
|
+ it('stage2 is started', function(){
|
|
|
|
+ controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage2'));
|
|
expect(controller.get('stages').findProperty('stage', 'stage2').get('isStarted')).to.equal(true);
|
|
expect(controller.get('stages').findProperty('stage', 'stage2').get('isStarted')).to.equal(true);
|
|
});
|
|
});
|
|
- it('third stage is started', function(){
|
|
|
|
- controller.set('stages', [
|
|
|
|
- App.Poll.create({stage: 'stage1', isStarted: true, isCompleted: true}),
|
|
|
|
- App.Poll.create({stage: 'stage2', isStarted: true, isCompleted: true}),
|
|
|
|
- App.Poll.create({stage: 'stage3', isStarted: false, isCompleted: false})
|
|
|
|
- ]);
|
|
|
|
- controller.moveToNextStage();
|
|
|
|
|
|
|
|
|
|
+ it('stage3 is started', function(){
|
|
|
|
+ controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage3'));
|
|
expect(controller.get('stages').findProperty('stage', 'stage3').get('isStarted')).to.equal(true);
|
|
expect(controller.get('stages').findProperty('stage', 'stage3').get('isStarted')).to.equal(true);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ it('stage4 is started', function(){
|
|
|
|
+ controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage4'));
|
|
|
|
+ expect(controller.get('stages').findProperty('stage', 'stage4').get('isStarted')).to.equal(true);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
});
|
|
});
|