step3_controller_test.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. var Ember = require('ember');
  20. require('models/host');
  21. require('controllers/wizard/stack_upgrade/step3_controller');
  22. if (!App.router) {
  23. App.router = Em.Object.create({});
  24. }
  25. App.router.set('stackUpgradeController', Em.Object.create({
  26. save: Em.K
  27. }));
  28. describe('App.StackUpgradeStep3Controller', function() {
  29. var stackUpgradeStep3Controller = App.StackUpgradeStep3Controller.create();
  30. describe('#runUpgradeErrorCallback', function() {
  31. var processes = [
  32. Ember.Object.create({
  33. status: '',
  34. isRetry: false,
  35. name: 'UPGRADE_SERVICES'
  36. })
  37. ];
  38. stackUpgradeStep3Controller.set('processes', processes);
  39. stackUpgradeStep3Controller.set('content', {cluster: {}, controllerName:'stackUpgradeController'});
  40. it('check process condition', function() {
  41. App.testMode = true;
  42. stackUpgradeStep3Controller.runUpgradeErrorCallback();
  43. expect(stackUpgradeStep3Controller.get('processes').findProperty('name', 'UPGRADE_SERVICES').get('status')).to.equal('FAILED');
  44. expect(stackUpgradeStep3Controller.get('processes').findProperty('name', 'UPGRADE_SERVICES').get('isRetry')).to.equal(true);
  45. expect(stackUpgradeStep3Controller.get('submitButton')).to.equal(false);
  46. App.testMode = false;
  47. });
  48. });
  49. });