step4_test.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('controllers/main/admin/security/add/step4');
  20. require('utils/polling');
  21. require('models/cluster_states');
  22. describe('App.MainAdminSecurityAddStep4Controller', function () {
  23. /**
  24. * Test object
  25. */
  26. var controller = App.MainAdminSecurityAddStep4Controller.create();
  27. describe('#moveToNextStage()', function () {
  28. controller.reopen({
  29. saveStages: function(){},
  30. enableSubmit: function(){},
  31. loadClusterConfigs: function(){}
  32. });
  33. App.clusterStatus.reopen({
  34. setClusterStatus: function(){}
  35. });
  36. controller.set('stages', [
  37. App.Poll.create({stage: 'stage2', isStarted: false, isPolling: true, isCompleted: false, start: function(){}}),
  38. App.Poll.create({stage: 'stage3', isStarted: false, isPolling: false, isCompleted: false, start: function(){}}),
  39. App.Poll.create({stage: 'stage4', isStarted: false, isPolling: true, isCompleted: false, start: function(){}})
  40. ]);
  41. it('stage2 is started', function(){
  42. controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage2'));
  43. expect(controller.get('stages').findProperty('stage', 'stage2').get('isStarted')).to.equal(true);
  44. });
  45. it('stage3 is started', function(){
  46. controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage3'));
  47. expect(controller.get('stages').findProperty('stage', 'stage3').get('isStarted')).to.equal(true);
  48. });
  49. it('stage4 is started', function(){
  50. controller.moveToNextStage(controller.get('stages').findProperty('stage', 'stage4'));
  51. expect(controller.get('stages').findProperty('stage', 'stage4').get('isStarted')).to.equal(true);
  52. });
  53. });
  54. });