step1_test.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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('controllers/main/admin/security/add/step1');
  20. require('models/service');
  21. var controller;
  22. describe('App.MainAdminSecurityAddStep1Controller', function () {
  23. beforeEach(function () {
  24. controller = App.MainAdminSecurityAddStep1Controller.create({
  25. content: {}
  26. });
  27. });
  28. describe('#shouldRemoveATS()', function () {
  29. var tests = Em.A([
  30. {
  31. doesATSSupportKerberos: true,
  32. isATSInstalled: true,
  33. e: false
  34. },
  35. {
  36. doesATSSupportKerberos: true,
  37. isATSInstalled: false,
  38. e: false
  39. },
  40. {
  41. doesATSSupportKerberos: false,
  42. isATSInstalled: true,
  43. e: true
  44. },
  45. {
  46. doesATSSupportKerberos: false,
  47. isATSInstalled: false,
  48. e: false
  49. }
  50. ]);
  51. tests.forEach(function (test) {
  52. it('', function () {
  53. controller.set('content.isATSInstalled', test.isATSInstalled);
  54. sinon.stub(App, 'get', function (k) {
  55. if ('doesATSSupportKerberos' === k) return test.doesATSSupportKerberos;
  56. return Em.get(App, k);
  57. });
  58. var result = controller.shouldRemoveATS();
  59. App.get.restore();
  60. expect(result).to.equal(test.e);
  61. });
  62. });
  63. });
  64. });