admin_test.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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('views/main/admin');
  20. describe('App.MainAdminView', function () {
  21. var view;
  22. beforeEach(function () {
  23. view = App.MainAdminView.create();
  24. });
  25. describe('#categories', function () {
  26. var cases = [
  27. {
  28. isHadoopWindowsStack: true,
  29. categories: [
  30. {
  31. name: 'stackAndUpgrade',
  32. url: 'stackAndUpgrade.index',
  33. label: Em.I18n.t('admin.stackUpgrade.title')
  34. },
  35. {
  36. name: 'adminServiceAccounts',
  37. url: 'adminServiceAccounts',
  38. label: Em.I18n.t('common.serviceAccounts')
  39. }
  40. ],
  41. title: 'HDPWIN'
  42. },
  43. {
  44. isHadoopWindowsStack: false,
  45. categories: [
  46. {
  47. name: 'stackAndUpgrade',
  48. url: 'stackAndUpgrade.index',
  49. label: Em.I18n.t('admin.stackUpgrade.title')
  50. },
  51. {
  52. name: 'adminServiceAccounts',
  53. url: 'adminServiceAccounts',
  54. label: Em.I18n.t('common.serviceAccounts')
  55. },
  56. {
  57. name: 'kerberos',
  58. url: 'adminKerberos.index',
  59. label: Em.I18n.t('common.kerberos')
  60. }
  61. ],
  62. title: 'not HDPWIN'
  63. }
  64. ];
  65. afterEach(function () {
  66. App.get.restore();
  67. });
  68. cases.forEach(function (item) {
  69. it(item.title, function () {
  70. sinon.stub(App, 'get').withArgs('isHadoopWindowsStack').returns(item.isHadoopWindowsStack);
  71. view.propertyDidChange('categories');
  72. expect(view.get('categories')).to.eql(item.categories);
  73. });
  74. });
  75. });
  76. });