step2_test.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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('controllers/wizard/step2_controller');
  21. describe.skip('App.WizardStep2Controller', function () {
  22. /*describe('#hostsError()', function () {
  23. it('should return t(installer.step2.hostName.error.required) if manualInstall is false, hostNames is empty, and hasSubmitted is true', function () {
  24. var controller = App.InstallerStep2Controller.create();
  25. controller.set('manualInstall', false);
  26. controller.set('hostNames', '');
  27. controller.set('hasSubmitted', true);
  28. expect(controller.get('hostsError')).to.equal(Ember.I18n.t('installer.step2.hostName.error.required'));
  29. })
  30. it('should return null if manualInstall is false, hostNames is not empty, and hasSubmitted is true', function () {
  31. var controller = App.InstallerStep2Controller.create();
  32. controller.set('manualInstall', false);
  33. controller.set('hostNames', 'ambari');
  34. controller.set('hasSubmitted', true);
  35. expect(controller.get('hostsError')).to.equal(null);
  36. })
  37. it('should return t(installer.step2.hostName.error.invalid) if manualInstall is false and hostNames has an element ' +
  38. 'that starts with a hyphen', function () {
  39. var controller = App.InstallerStep2Controller.create();
  40. controller.set('manualInstall', false);
  41. controller.set('hostNames', "-apache");
  42. expect(controller.get('hostsError')).to.equal(Ember.I18n.t('installer.step2.hostName.error.invalid'));
  43. })
  44. it('should return t(installer.step2.hostName.error.invalid) if manualInstall is false and hostNames has an element ' +
  45. 'that ends with a hyphen', function () {
  46. var controller = App.InstallerStep2Controller.create();
  47. controller.set('manualInstall', false);
  48. controller.set('hostNames', 'apache-');
  49. expect(controller.get('hostsError')).to.equal(Ember.I18n.t('installer.step2.hostName.error.invalid'));
  50. })
  51. it('should return t(installer.step2.hostName.error.required) if manualInstall is true, hostNames is empty, and ' +
  52. 'hasSubmitted is true', function () {
  53. var controller = App.InstallerStep2Controller.create();
  54. controller.set('manualInstall', true);
  55. controller.set('hostNames', '');
  56. controller.set('hasSubmitted', true);
  57. expect(controller.get('hostsError')).to.equal(Ember.I18n.t('installer.step2.hostName.error.required'));
  58. })
  59. })
  60. describe('#sshKeyError()', function () {
  61. it('should return t(installer.step2.sshKey.error.required) to true if manualInstall is false, sshKey is empty, ' +
  62. 'and hasSubmitted is true', function () {
  63. var controller = App.InstallerStep2Controller.create();
  64. controller.set('manualInstall', false);
  65. controller.set('sshKey', '');
  66. controller.set('hasSubmitted', true);
  67. expect(controller.get('sshKeyError')).to.equal(Ember.I18n.t('installer.step2.sshKey.error.required'));
  68. })
  69. it('should return null if manualInstall is true, sshKey is empty, and hasSubmitted is true', function () {
  70. var controller = App.InstallerStep2Controller.create();
  71. controller.set('sshKey', '');
  72. controller.set('manualInstall', true);
  73. controller.set('hasSubmitted', true);
  74. expect(controller.get('sshKeyError')).to.equal(null);
  75. })
  76. it('should return null if sshKey is not null and hasSubmitted is true', function () {
  77. var controller = App.InstallerStep2Controller.create();
  78. controller.set('sshKey', 'ambari');
  79. controller.set('hasSubmitted', true);
  80. expect(controller.get('sshKeyError')).to.equal(null);
  81. })
  82. })*/
  83. /* Passphrase has been disabled, so commenting out tests
  84. it('should set passphraseMatchErr to true if ' +
  85. 'passphrase and confirmPassphrase doesn\'t match ', function () {
  86. var controller = App.InstallerStep2Controller.create();
  87. controller.set('manualInstall', false);
  88. controller.set('passphrase', 'apache ambari');
  89. controller.set('confirmPassphrase', 'ambari');
  90. controller.validateStep2();
  91. expect(controller.get('passphraseMatchErr')).to.equal(true);
  92. })
  93. it('should set passphraseMatchErr to false if passphrase and ' +
  94. 'confirmPassphrase doesn\'t match but manualInstall is true ', function () {
  95. var controller = App.InstallerStep2Controller.create();
  96. controller.set('passphrase', 'apache ambari');
  97. controller.set('confirmPassphrase', 'ambari');
  98. controller.set('manualInstall', true);
  99. controller.validateStep2();
  100. expect(controller.get('passphraseMatchErr')).to.equal(false);
  101. })
  102. it('should set passphraseMatchErr to true if passphrase and ' +
  103. 'confirmPassphrase matches', function () {
  104. var controller = App.InstallerStep2Controller.create();
  105. controller.set('passphrase', 'apache ambari');
  106. controller.set('confirmPassphrase', 'apache ambari');
  107. controller.validateStep2();
  108. expect(controller.get('passphraseMatchErr')).to.equal(false);
  109. })
  110. */
  111. /*describe('#localRepoError()', function() {
  112. it('should return t(installer.step2.localRepo.error.required) localRepo is true, localRepoPath is empty, and hasSubmitted is true', function () {
  113. var controller = App.InstallerStep2Controller.create();
  114. controller.set('localRepo', true);
  115. controller.set('localRepoPath', '');
  116. controller.set('hasSubmitted', true);
  117. expect(controller.get('localRepoError')).to.equal(Ember.I18n.t('installer.step2.localRepo.error.required'));
  118. })
  119. it('should return null if localRepo is true, localRepoPath is not empty, and hasSubmitted is true', function () {
  120. var controller = App.InstallerStep2Controller.create();
  121. controller.set('localRepo', true);
  122. controller.set('localRepoPath', '/etc/');
  123. controller.set('hasSubmitted', true);
  124. expect(controller.get('localRepoError')).to.equal(null);
  125. })
  126. it('should return null if localRepo is false, localRepoPath is empty, and hasSubmitted is true', function () {
  127. var controller = App.InstallerStep2Controller.create();
  128. controller.set('localRepo', false);
  129. controller.set('localRepoPath', '');
  130. controller.set('hasSubmitted', true);
  131. expect(controller.get('localRepoError')).to.equal(null);
  132. })
  133. })
  134. describe('#evaluateStep2(): On hitting step2 \"next\" button', function () {
  135. it('should return false if isSubmitDisabled is true ', function () {
  136. var controller = App.InstallerStep2Controller.create();
  137. controller.set('isSubmitDisabled', true);
  138. expect(controller.evaluateStep2()).to.equal(false);
  139. })
  140. })*/
  141. })