installer_test.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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('models/cluster');
  20. require('controllers/wizard');
  21. require('controllers/installer');
  22. describe('App.InstallerController', function () {
  23. var installerController = App.InstallerController.create();
  24. describe('#loadStacksVersionsSuccessCallback', function() {
  25. var test_data = {
  26. "items" : [
  27. {
  28. "href" : "http://ec2-54-224-185-227.compute-1.amazonaws.com:8080/api/v1/stacks2/HDP/versions/1.2.0",
  29. "Versions" : {
  30. "active" : false,
  31. "min_upgrade_version" : null,
  32. "stack_name" : "HDP",
  33. "stack_version" : "1.2.0"
  34. }
  35. },
  36. {
  37. "href" : "http://ec2-54-224-185-227.compute-1.amazonaws.com:8080/api/v1/stacks2/HDP/versions/1.2.1",
  38. "Versions" : {
  39. "active" : true,
  40. "min_upgrade_version" : null,
  41. "stack_name" : "HDP",
  42. "stack_version" : "1.2.1"
  43. }
  44. },
  45. {
  46. "href" : "http://ec2-54-224-185-227.compute-1.amazonaws.com:8080/api/v1/stacks2/HDP/versions/1.3.0",
  47. "Versions" : {
  48. "active" : true,
  49. "min_upgrade_version" : "1.2.0",
  50. "stack_name" : "HDP",
  51. "stack_version" : "1.3.0"
  52. }
  53. },
  54. {
  55. "href" : "http://ec2-54-224-185-227.compute-1.amazonaws.com:8080/api/v1/stacks2/HDP/versions/2.0.1",
  56. "Versions" : {
  57. "active" : false,
  58. "min_upgrade_version" : null,
  59. "stack_name" : "HDP",
  60. "stack_version" : "2.0.1"
  61. }
  62. }
  63. ]
  64. }
  65. it ('Correct data', function() {
  66. installerController.loadStacksVersionsSuccessCallback(test_data);
  67. expect(installerController.get('stacks.length')).to.equal(2);
  68. expect(installerController.get('stacks').everyProperty('isSelected')).to.equal(false);
  69. expect(installerController.get('stacks').mapProperty('name')).to.eql(['HDP-1.3.0', 'HDP-1.2.1']);
  70. });
  71. });
  72. });