step4_controller_test.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. describe('App.KerberosWizardStep4Controller', function() {
  20. describe('#isSubmitDisabled', function() {
  21. var controller = App.KerberosWizardStep4Controller.create({});
  22. var configCategories = Em.A([
  23. App.ServiceConfigCategory.create({ name: 'Advanced', displayName: 'Advanced'})
  24. ]);
  25. var configs = Em.A([
  26. App.ServiceConfigProperty.create({ name: 'prop1', value: 'someVal1', category: 'Advanced'})
  27. ]);
  28. controller.set('stepConfigs', [controller.createServiceConfig(configCategories, configs)]);
  29. it('configuration errors are absent, submit should be not disabled', function() {
  30. expect(controller.get('stepConfigs')[0].get('errorCount')).to.be.eql(0);
  31. expect(controller.get('isSubmitDisabled')).to.be.false;
  32. });
  33. it('config has invalid value, submit should be disabled', function() {
  34. var serviceConfig = controller.get('stepConfigs')[0];
  35. serviceConfig.get('configs').findProperty('name', 'prop1').set('value', '');
  36. expect(serviceConfig.get('errorCount')).to.be.eql(1);
  37. expect(controller.get('isSubmitDisabled')).to.be.true;
  38. });
  39. });
  40. describe('#createServiceConfig', function() {
  41. var controller = App.KerberosWizardStep4Controller.create({});
  42. it('should create instance of App.ServiceConfig', function() {
  43. expect(controller.createServiceConfig([], [])).be.instanceof(App.ServiceConfig);
  44. });
  45. });
  46. });