|
@@ -25,6 +25,75 @@ require('templates/main/alerts/alert_instance/status');
|
|
|
function getController() {
|
|
|
return App.ManageAlertNotificationsController.create({});
|
|
|
}
|
|
|
+
|
|
|
+function getInputFields() {
|
|
|
+ return Em.Object.create({
|
|
|
+ name: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ groups: {
|
|
|
+ value: []
|
|
|
+ },
|
|
|
+ global: {
|
|
|
+ value: false
|
|
|
+ },
|
|
|
+ allGroups: {
|
|
|
+ value: false
|
|
|
+ },
|
|
|
+ method: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ email: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ severityFilter: {
|
|
|
+ value: []
|
|
|
+ },
|
|
|
+ description: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPServer: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPPort: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPUseAuthentication: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPUsername: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPPassword: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ retypeSMTPPassword: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ SMTPSTARTTLS: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ emailFrom: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ version: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ OIDs: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ community: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ host: {
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ port: {
|
|
|
+ value: ''
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
var createEditPopupView = getController().showCreateEditPopup();
|
|
|
|
|
|
describe('App.ManageAlertNotificationsController', function () {
|
|
@@ -610,6 +679,12 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
|
|
|
describe('#smtpUsernameValidation', function () {
|
|
|
|
|
|
+ beforeEach(function () {
|
|
|
+ view.set('controller.inputFields', getInputFields());
|
|
|
+ view.set('controller.inputFields.emailFrom.value', '1@2.com');
|
|
|
+ view.set('controller.inputFields.method.value', 'EMAIL');
|
|
|
+ });
|
|
|
+
|
|
|
it('should check inputFields.SMTPUsername.value', function () {
|
|
|
|
|
|
view.set('parentView.hasErrors', false);
|
|
@@ -619,7 +694,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', 'pass');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', 'pass');
|
|
|
expect(view.get('controller.inputFields.SMTPUsername.errorMsg')).to.equal(Em.I18n.t('alerts.notifications.error.SMTPUsername'));
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.true;
|
|
|
+ expect(view.get('smtpUsernameError')).to.be.true;
|
|
|
|
|
|
});
|
|
|
|
|
@@ -632,7 +707,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', 'pass');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', 'pass');
|
|
|
expect(view.get('controller.inputFields.SMTPUsername.errorMsg')).to.equal(null);
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.false;
|
|
|
+ expect(view.get('smtpUsernameError')).to.be.false;
|
|
|
|
|
|
});
|
|
|
|
|
@@ -645,7 +720,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', '');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', '');
|
|
|
expect(view.get('controller.inputFields.SMTPUsername.errorMsg')).to.equal(null);
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.false;
|
|
|
+ expect(view.get('smtpUsernameError')).to.be.false;
|
|
|
|
|
|
});
|
|
|
|
|
@@ -653,6 +728,12 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
|
|
|
describe('#smtpPasswordValidation', function () {
|
|
|
|
|
|
+ beforeEach(function () {
|
|
|
+ view.set('controller.inputFields', getInputFields());
|
|
|
+ view.set('controller.inputFields.emailFrom.value', '1@2.com');
|
|
|
+ view.set('controller.inputFields.method.value', 'EMAIL');
|
|
|
+ });
|
|
|
+
|
|
|
it('should check inputFields.SMTPPassword.value', function () {
|
|
|
|
|
|
view.set('parentView.hasErrors', false);
|
|
@@ -662,7 +743,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', '');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', '');
|
|
|
expect(view.get('controller.inputFields.SMTPPassword.errorMsg')).to.equal(Em.I18n.t('alerts.notifications.error.SMTPPassword'));
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.true;
|
|
|
+ expect(view.get('smtpPasswordError')).to.be.true;
|
|
|
|
|
|
});
|
|
|
|
|
@@ -675,7 +756,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', 'test');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', 'test');
|
|
|
expect(view.get('controller.inputFields.SMTPPassword.errorMsg')).to.equal(null);
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.false;
|
|
|
+ expect(view.get('smtpPasswordError')).to.be.false;
|
|
|
|
|
|
});
|
|
|
|
|
@@ -688,7 +769,7 @@ describe('App.ManageAlertNotificationsController', function () {
|
|
|
view.set('controller.inputFields.SMTPPassword.value', '');
|
|
|
view.set('controller.inputFields.retypeSMTPPassword.value', '');
|
|
|
expect(view.get('controller.inputFields.SMTPPassword.errorMsg')).to.equal(null);
|
|
|
- expect(view.get('parentView.hasErrors')).to.be.false;
|
|
|
+ expect(view.get('smtpPasswordError')).to.be.false;
|
|
|
|
|
|
});
|
|
|
|