step3_test.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 Ember = require('ember');
  19. var App = require('app');
  20. require('models/hosts');
  21. require('controllers/wizard/step3_controller');
  22. /*
  23. describe('App.InstallerStep3Controller', function () {
  24. //var controller = App.InstallerStep3Controller.create();
  25. describe('#parseHostInfo', function () {
  26. var controller = App.InstallerStep3Controller.create();
  27. it('should return true if there is no host with pending status in the data provided by REST bootstrap call. It should also update the status on the client side', function () {
  28. var hostFromServer = [
  29. {
  30. name: '192.168.1.1',
  31. status: 'error'
  32. },
  33. {
  34. name: '192.168.1.2',
  35. status: 'success'
  36. },
  37. {
  38. name: '192.168.1.3',
  39. status: 'error'
  40. },
  41. {
  42. name: '192.168.1.4',
  43. status: 'success'
  44. }
  45. ];
  46. controller.content.pushObject(App.HostInfo.create({
  47. name: '192.168.1.1',
  48. status: 'error'
  49. }));
  50. controller.content.pushObject(App.HostInfo.create({
  51. name: '192.168.1.2',
  52. status: 'success'
  53. }));
  54. controller.content.pushObject(App.HostInfo.create({
  55. name: '192.168.1.3',
  56. status: 'pending' //status should be overriden to 'error' after the parseHostInfo call
  57. }));
  58. controller.content.pushObject(App.HostInfo.create({
  59. name: '192.168.1.4',
  60. status: 'success'
  61. }));
  62. var result = controller.parseHostInfo(hostFromServer, controller.content);
  63. var host = controller.content.findProperty('name', '192.168.1.3');
  64. expect(result).to.equal(true);
  65. expect(host.bootStatus).to.equal('error');
  66. })
  67. })
  68. describe('#onAllChecked', function () {
  69. var controller = App.InstallerStep3Controller.create();
  70. it('should set all visible hosts\'s isChecked to true upon checking the "all" checkbox', function () {
  71. controller.set('category', 'All Hosts');
  72. controller.set('allChecked', true);
  73. controller.content.pushObject(App.HostInfo.create({
  74. name: '192.168.1.1',
  75. status: 'error',
  76. isChecked: false
  77. }));
  78. controller.content.pushObject(App.HostInfo.create({
  79. name: '192.168.1.2',
  80. status: 'success',
  81. isChecked: false
  82. }));
  83. controller.content.pushObject(App.HostInfo.create({
  84. name: '192.168.1.3',
  85. status: 'pending', //status should be overriden to 'error' after the parseHostInfo call
  86. isChecked: true
  87. }));
  88. controller.content.pushObject(App.HostInfo.create({
  89. name: '192.168.1.4',
  90. status: 'success',
  91. isChecked: false
  92. }));
  93. controller.onAllChecked();
  94. controller.content.forEach(function (host) {
  95. var result = host.get('isChecked');
  96. expect(result).to.equal(true);
  97. });
  98. })
  99. })
  100. })
  101. */