This is an automated email from the ASF dual-hosted git repository. ababiichuk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 6f856ee AMBARI-25122 UI unit tests are sometimes failing. (ababiichuk) 6f856ee is described below commit 6f856eee063bd91de5eff0e025af36fa15e9e821 Author: ababiichuk <ababiic...@hortonworks.com> AuthorDate: Wed Jan 23 19:44:12 2019 +0200 AMBARI-25122 UI unit tests are sometimes failing. (ababiichuk) --- ambari-web/app/assets/test/tests.js | 4 ++ ambari-web/test/controllers/application_test.js | 4 +- .../global/user_settings_controller_test.js | 2 - .../progress_popup_controller_test.js | 2 - .../test/controllers/main/admin/kerberos_test.js | 2 - .../admin/stack_and_upgrade_controller_test.js | 4 -- .../alert_definitions_actions_controller_test.js | 8 ---- .../manage_alert_notifications_controller_test.js | 8 ---- .../test/controllers/main/host/details_test.js | 41 -------------------- .../test/controllers/main/service/item_test.js | 11 +----- ambari-web/test/controllers/wizard/step2_test.js | 14 ------- ambari-web/test/controllers/wizard/step3_test.js | 44 ---------------------- .../wizard/step7/assign_master_controller_test.js | 4 -- ambari-web/test/controllers/wizard/step7_test.js | 10 ----- ambari-web/test/controllers/wizard/step8_test.js | 12 ------ ambari-web/test/controllers/wizard_test.js | 6 +-- .../service/configs/config_overridable_test.js | 6 --- ambari-web/test/utils/host_progress_popup_test.js | 8 ---- ambari-web/test/utils/hosts_test.js | 13 +------ .../configs/config_versions_control_view_test.js | 2 +- .../common/configs/service_config_view_test.js | 2 - .../stack_upgrade/upgrade_version_box_view_test.js | 6 +-- .../test/views/main/dashboard/widget_test.js | 9 ----- .../wizard/step3/hostWarningPopupBody_view_test.js | 9 ----- 24 files changed, 11 insertions(+), 220 deletions(-) diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index e1808da..e1c31da 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -562,6 +562,9 @@ describe('Ambari Web Unit tests', function() { }); sinon.stub(App.updater, 'run', Em.K); sinon.stub(App.updater, 'immediateRun', Em.K); + sinon.stub(App.ModalPopup, 'show', function (options) { + return this.create(options); + }); }); afterEach(function () { @@ -569,6 +572,7 @@ describe('Ambari Web Unit tests', function() { $.ajax.restore(); App.updater.run.restore(); App.updater.immediateRun.restore(); + App.ModalPopup.show.restore(); }); files.forEach(function (file) { diff --git a/ambari-web/test/controllers/application_test.js b/ambari-web/test/controllers/application_test.js index 2333e5e..dc22133 100644 --- a/ambari-web/test/controllers/application_test.js +++ b/ambari-web/test/controllers/application_test.js @@ -40,13 +40,11 @@ describe('App.ApplicationController', function () { describe('#showAboutPopup', function() { var dataToShowRes = {}; beforeEach(function () { + App.ModalPopup.show.restore(); sinon.stub(App.ModalPopup, 'show', function(dataToShow){ dataToShowRes = dataToShow; }); }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); it ('Should send correct data to popup', function() { applicationController.showAboutPopup(); dataToShowRes = JSON.parse(JSON.stringify(dataToShowRes)); diff --git a/ambari-web/test/controllers/global/user_settings_controller_test.js b/ambari-web/test/controllers/global/user_settings_controller_test.js index f68c109..ef9e9a2 100644 --- a/ambari-web/test/controllers/global/user_settings_controller_test.js +++ b/ambari-web/test/controllers/global/user_settings_controller_test.js @@ -336,12 +336,10 @@ describe('App.UserSettingsController', function () { describe('#_showSettingsPopup()', function() { beforeEach(function() { - sinon.stub(App.ModalPopup, 'show'); sinon.stub(App, 'showAlertPopup'); }); afterEach(function() { - App.ModalPopup.show.restore(); App.showAlertPopup.restore(); }); diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js index b14bf86..213f95a 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js @@ -239,13 +239,11 @@ describe('App.HighAvailabilityProgressPopupController', function () { describe("#initPopup()", function () { beforeEach(function() { - sinon.stub(App.ModalPopup, 'show'); sinon.stub(controller, 'getHosts'); sinon.stub(controller, 'setProperties'); }); afterEach(function() { - App.ModalPopup.show.restore(); controller.getHosts.restore(); controller.setProperties.restore(); }); diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js index d347416..0dd0bac 100644 --- a/ambari-web/test/controllers/main/admin/kerberos_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos_test.js @@ -131,12 +131,10 @@ describe('App.MainAdminKerberosController', function() { describe('#regenerateKeytabs()', function () { beforeEach(function () { - sinon.spy(App.ModalPopup, "show"); sinon.spy(controller, 'restartServicesAfterRegenerate'); sinon.spy(controller, 'restartAllServices'); }); afterEach(function () { - App.ModalPopup.show.restore(); controller.restartServicesAfterRegenerate.restore(); controller.restartAllServices.restore(); }); diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js index 34f48c2..82c6961 100644 --- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js +++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js @@ -983,7 +983,6 @@ describe('App.MainAdminStackAndUpgradeController', function() { describe("#upgradeOptions()", function() { var version = Em.Object.create({displayName: 'HDP-2.2'}); beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); sinon.spy(App, 'showConfirmationFeedBackPopup'); sinon.stub(controller, 'getSupportedUpgradeTypes').returns({ done: function (callback) { @@ -1006,7 +1005,6 @@ describe('App.MainAdminStackAndUpgradeController', function() { }); afterEach(function () { - App.ModalPopup.show.restore(); App.showConfirmationFeedBackPopup.restore(); controller.runPreUpgradeCheck.restore(); controller.getSupportedUpgradeTypes.restore(); @@ -3629,12 +3627,10 @@ describe('App.MainAdminStackAndUpgradeController', function() { describe('#confirmRevertPatchUpgrade', function() { beforeEach(function() { sinon.stub(App.RepositoryVersion, 'find').returns(Em.Object.create()); - sinon.stub(App.ModalPopup, 'show'); sinon.stub(controller, 'getServicesToBeReverted'); }); afterEach(function() { App.RepositoryVersion.find.restore(); - App.ModalPopup.show.restore(); controller.getServicesToBeReverted.restore(); }); diff --git a/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js b/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js index dc8bd0d..dffbc5d 100644 --- a/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js +++ b/ambari-web/test/controllers/main/alerts/alert_definitions_actions_controller_test.js @@ -55,14 +55,6 @@ describe('App.MainAlertDefinitionActionsController', function () { describe('#manageAlertGroups', function () { - beforeEach(function () { - sinon.stub(App.ModalPopup, 'show', Em.K); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should show modal popup', function () { controller.manageAlertGroups(); expect(App.ModalPopup.show.calledOnce).to.be.true; diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js index bbf4b98..ed48e25 100644 --- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js +++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js @@ -912,14 +912,6 @@ describe('App.ManageAlertNotificationsController', function () { describe("#showCreateEditPopup()", function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it("should open popup and set popup object to createEditPopup", function () { controller.showCreateEditPopup(); diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index 78bdf5b..9a8d603 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -889,14 +889,6 @@ describe('App.MainHostDetailsController', function () { describe('#showAddComponentPopup()', function () { - beforeEach(function () { - sinon.stub(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should display add component confirmation', function () { controller.showAddComponentPopup(Em.Object.create()); expect(App.ModalPopup.show.calledOnce).to.be.true; @@ -1547,14 +1539,6 @@ describe('App.MainHostDetailsController', function () { describe('#installComponent()', function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, "show"); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('popup should be displayed', function () { var event = {context: Em.Object.create()}; var popup = controller.installComponent(event); @@ -1802,12 +1786,6 @@ describe('App.MainHostDetailsController', function () { }); describe('#showRegionServerWarning()', function () { - beforeEach(function () { - sinon.stub(App.ModalPopup, 'show', Em.K); - }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); it('modal popup is shown', function () { controller.showRegionServerWarning(); expect(App.ModalPopup.show.calledOnce).to.be.true; @@ -2406,14 +2384,6 @@ describe('App.MainHostDetailsController', function () { }); describe('#raiseDeleteComponentsError()', function () { - - beforeEach(function () { - sinon.stub(App.ModalPopup, "show", Em.K); - }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('Popup should be displayed', function () { controller.raiseDeleteComponentsError([], ''); expect(App.ModalPopup.show.calledOnce).to.be.true; @@ -2423,12 +2393,10 @@ describe('App.MainHostDetailsController', function () { describe('#confirmDeleteHost()', function () { beforeEach(function () { - sinon.spy(App.ModalPopup, "show"); sinon.stub(controller, 'doDeleteHost'); }); afterEach(function () { - App.ModalPopup.show.restore(); controller.doDeleteHost.restore(); }); @@ -2805,15 +2773,6 @@ describe('App.MainHostDetailsController', function () { }); describe('#showHbaseActiveWarning()', function () { - - beforeEach(function () { - sinon.spy(App.ModalPopup, "show"); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('popup should be displayed', function () { controller.showHbaseActiveWarning(Em.Object.create({service: {}})); expect(App.ModalPopup.show.calledOnce).to.be.true; diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js index e51ba05..3cc02ea 100644 --- a/ambari-web/test/controllers/main/service/item_test.js +++ b/ambari-web/test/controllers/main/service/item_test.js @@ -1487,7 +1487,6 @@ describe('App.MainServiceItemController', function () { this.mockService = sinon.stub(App.Service, 'find'); this.mockRangerPluginEnabled = sinon.stub(mainServiceItemController, 'isRangerPluginEnabled'); sinon.stub(App, 'showConfirmationPopup'); - sinon.stub(App.ModalPopup, 'show'); sinon.stub(App.format, 'role', function(name) {return name}); sinon.stub(mainServiceItemController, 'kerberosDeleteWarning'); sinon.stub(mainServiceItemController, 'showLastWarning'); @@ -1503,7 +1502,6 @@ describe('App.MainServiceItemController', function () { this.mockService.restore(); mainServiceItemController.dependentServicesWarning.restore(); App.showConfirmationPopup.restore(); - App.ModalPopup.show.restore(); App.format.role.restore(); mainServiceItemController.kerberosDeleteWarning.restore(); this.mockRangerPluginEnabled.restore(); @@ -1579,12 +1577,10 @@ describe('App.MainServiceItemController', function () { beforeEach(function() { mainServiceItemController = App.MainServiceItemController.create({}); - sinon.spy(App.ModalPopup, 'show'); sinon.stub(App.router, 'transitionTo'); }); afterEach(function() { - App.ModalPopup.show.restore(); App.router.transitionTo.restore(); }); @@ -1601,11 +1597,9 @@ describe('App.MainServiceItemController', function () { beforeEach(function() { mainServiceItemController = App.MainServiceItemController.create({}); - sinon.stub(App.ModalPopup, 'show'); sinon.stub(App.format, 'role', function(name) {return name}); }); afterEach(function() { - App.ModalPopup.show.restore(); App.format.role.restore(); }); @@ -1619,11 +1613,8 @@ describe('App.MainServiceItemController', function () { var mainServiceItemController; beforeEach(function () { - mainServiceItemController = App.MainServiceItemController.create(); - }); - - afterEach(function () { App.ModalPopup.show.restore(); + mainServiceItemController = App.MainServiceItemController.create(); }); describe('confirmation popup', function () { diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js index c1614b9..ccc506f 100644 --- a/ambari-web/test/controllers/wizard/step2_test.js +++ b/ambari-web/test/controllers/wizard/step2_test.js @@ -505,11 +505,9 @@ describe('App.WizardStep2Controller', function () { describe('#installedHostsPopup', function() { beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(c, 'proceedNext', Em.K); }); afterEach(function() { - App.ModalPopup.show.restore(); c.proceedNext.restore(); }); it('should call App.ModalPopup.show', function() { @@ -524,11 +522,9 @@ describe('App.WizardStep2Controller', function () { describe('#warningPopup', function() { beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(c, 'proceedNext', Em.K); }); afterEach(function() { - App.ModalPopup.show.restore(); c.proceedNext.restore(); }); @@ -544,11 +540,9 @@ describe('App.WizardStep2Controller', function () { describe('#hostNamePatternPopup', function() { beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(c, 'proceedNext', Em.K); }); afterEach(function() { - App.ModalPopup.show.restore(); c.proceedNext.restore(); }); it('should call App.ModalPopup.show', function() { @@ -563,12 +557,10 @@ describe('App.WizardStep2Controller', function () { describe('#manualInstallPopup', function() { beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(App.router, 'send', Em.K); sinon.stub(c, 'saveHosts', Em.K); }); afterEach(function() { - App.ModalPopup.show.restore(); App.router.send.restore(); c.saveHosts.restore(); }); @@ -584,12 +576,6 @@ describe('App.WizardStep2Controller', function () { }); describe('#manualInstallWarningPopup', function() { - beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); - }); - afterEach(function() { - App.ModalPopup.show.restore(); - }); it('should call App.ModalPopup.show if content.installOptions.useSsh is false', function() { var controller = App.WizardStep2Controller.create({content: {installOptions: {useSsh: false}}}); controller.manualInstallWarningPopup(); diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js index b8bc794..0101402 100644 --- a/ambari-web/test/controllers/wizard/step3_test.js +++ b/ambari-web/test/controllers/wizard/step3_test.js @@ -405,14 +405,6 @@ describe('App.WizardStep3Controller', function () { describe('#selectedHostsPopup', function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should show App.ModalPopup', function () { c.selectedHostsPopup(); expect(App.ModalPopup.show.calledOnce).to.equal(true); @@ -950,15 +942,6 @@ describe('App.WizardStep3Controller', function () { }); describe('#registerErrPopup', function () { - - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should call App.ModalPopup.show', function () { c.registerErrPopup(); expect(App.ModalPopup.show.calledOnce).to.equal(true); @@ -1036,14 +1019,6 @@ describe('App.WizardStep3Controller', function () { describe('#submit', function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('if isHostHaveWarnings should show confirmation popup', function () { c.reopen({isHostHaveWarnings: true}); c.submit(); @@ -1072,14 +1047,6 @@ describe('App.WizardStep3Controller', function () { describe('#hostLogPopup', function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should show App.ModalPopup', function () { c.hostLogPopup({context: Em.Object.create({})}); expect(App.ModalPopup.show.calledOnce).to.equal(true); @@ -1187,12 +1154,10 @@ describe('App.WizardStep3Controller', function () { describe('#hostWarningsPopup', function () { beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(c, 'rerunChecks', Em.K); }); afterEach(function () { - App.ModalPopup.show.restore(); c.rerunChecks.restore(); }); @@ -1220,15 +1185,6 @@ describe('App.WizardStep3Controller', function () { }); describe('#registeredHostsPopup', function () { - - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should show App.ModalPopup', function () { c.registeredHostsPopup(); expect(App.ModalPopup.show.calledOnce).to.equal(true); diff --git a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js index 16c9681..c11dbe7 100644 --- a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js +++ b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js @@ -103,12 +103,10 @@ describe('App.AssignMasterOnStep7Controller', function () { beforeEach(function() { sinon.stub(view, 'loadMasterComponentHosts'); - sinon.stub(App.ModalPopup, 'show'); }); afterEach(function() { view.loadMasterComponentHosts.restore(); - App.ModalPopup.show.restore(); }); it("loadMasterComponentHosts should be called", function() { @@ -151,7 +149,6 @@ describe('App.AssignMasterOnStep7Controller', function () { sinon.stub(mock, 'setValue'); sinon.stub(mock, 'toggleProperty'); sinon.stub(mock, 'sendRequestRorDependentConfigs'); - sinon.spy(App.ModalPopup, 'show'); }); afterEach(function() { @@ -159,7 +156,6 @@ describe('App.AssignMasterOnStep7Controller', function () { mock.setValue.restore(); mock.toggleProperty.restore(); mock.sendRequestRorDependentConfigs.restore(); - App.ModalPopup.show.restore(); }); it("test", function() { diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js index 7fa387f..0efdc99 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1722,11 +1722,6 @@ describe('App.InstallerStep7Controller', function () { beforeEach(function() { controller = App.WizardStep7Controller.create({}); - sinon.stub(App.ModalPopup, 'show', Em.K); - }); - - afterEach(function() { - App.ModalPopup.show.restore(); }); Em.A([ @@ -1826,14 +1821,11 @@ describe('App.InstallerStep7Controller', function () { sinon.stub(installerStep7Controller, 'checkMySQLHost', function () { return $.Deferred().resolve(); }); - sinon.spy(App.ModalPopup, 'show'); }); afterEach(function () { installerStep7Controller.moveNext.restore(); installerStep7Controller.checkMySQLHost.restore(); - - App.ModalPopup.show.restore(); }); it('no HIVE service', function () { @@ -1855,13 +1847,11 @@ describe('App.InstallerStep7Controller', function () { beforeEach(function () { installerStep7Controller.set('mySQLServerConflict', true); - sinon.spy(App.ModalPopup, 'show'); sinon.stub(App.router, 'get').returns({gotoStep: Em.K}); sinon.stub(App.router.get(), 'gotoStep', Em.K); }); afterEach(function () { - App.ModalPopup.show.restore(); App.router.get().gotoStep.restore(); App.router.get.restore(); }); diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js index 7512e08..416c902 100644 --- a/ambari-web/test/controllers/wizard/step8_test.js +++ b/ambari-web/test/controllers/wizard/step8_test.js @@ -1932,14 +1932,9 @@ describe('App.WizardStep8Controller', function () { isSubmitDisabled: true, isBackBtnDisabled: true }); - sinon.stub(App.ModalPopup, 'show', Em.K); installerStep8Controller.showDeleteClustersErrorPopup(); }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should show error popup and unlock navigation', function () { expect(installerStep8Controller.get('isSubmitDisabled')).to.be.false; expect(installerStep8Controller.get('isBackBtnDisabled')).to.be.false; @@ -2282,13 +2277,6 @@ describe('App.WizardStep8Controller', function () { describe('#showLoadingIndicator', function() { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); it('if popup doesn\'t exist should create another', function() { installerStep8Controller.set('isSubmitDisabled', true); diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js index 291ef55..94b4661 100644 --- a/ambari-web/test/controllers/wizard_test.js +++ b/ambari-web/test/controllers/wizard_test.js @@ -264,7 +264,7 @@ describe('App.WizardController', function () { }); describe('#showLaunchBootstrapPopup', function () { - afterEach(function(){ + beforeEach(function(){ App.ModalPopup.show.restore(); }); @@ -583,12 +583,10 @@ describe('App.WizardController', function () { describe('#gotoStep', function () { beforeEach(function(){ - sinon.stub(App.ModalPopup,'show', Em.K); - sinon.stub(App.clusterStatus,'setClusterStatus', Em.K); + sinon.stub(App.clusterStatus,'setClusterStatus', Em.K); sinon.stub(App.router,'send', Em.K); }); afterEach(function(){ - App.ModalPopup.show.restore(); App.clusterStatus.setClusterStatus.restore(); App.router.send.restore(); }); diff --git a/ambari-web/test/mixins/main/service/configs/config_overridable_test.js b/ambari-web/test/mixins/main/service/configs/config_overridable_test.js index 198d854..3e7fadc 100644 --- a/ambari-web/test/mixins/main/service/configs/config_overridable_test.js +++ b/ambari-web/test/mixins/main/service/configs/config_overridable_test.js @@ -103,13 +103,11 @@ describe('App.ConfigOverridable', function () { beforeEach(function() { sinon.stub(configOverridable, 'launchConfigGroupSelectionCreationDialog'); - sinon.stub(App.ModalPopup, 'show'); sinon.stub(App.config, 'createOverride'); }); afterEach(function() { configOverridable.launchConfigGroupSelectionCreationDialog.restore(); - App.ModalPopup.show.restore(); App.config.createOverride.restore(); }); @@ -284,14 +282,12 @@ describe('App.ConfigOverridable', function () { }; beforeEach(function() { - sinon.spy(App.ModalPopup, 'show'); sinon.stub(configOverridable, 'updateConfigurationGroup'); sinon.spy(mock, 'callback'); }); afterEach(function() { configOverridable.updateConfigurationGroup.restore(); - App.ModalPopup.show.restore(); mock.callback.restore(); }); @@ -374,7 +370,6 @@ describe('App.ConfigOverridable', function () { }); sinon.stub(configOverridable.get('controller'), 'doSelectConfigGroup'); sinon.stub(App.ServiceConfigGroup, 'find').returns([group]); - sinon.spy(App.ModalPopup, 'show'); sinon.stub(App.router, 'get').returns(mock); sinon.spy(mock, 'manageConfigurationGroups'); }); @@ -383,7 +378,6 @@ describe('App.ConfigOverridable', function () { configOverridable.get('controller').loadConfigGroups.restore(); configOverridable.get('controller').doSelectConfigGroup.restore(); App.ServiceConfigGroup.find.restore(); - App.ModalPopup.show.restore(); App.router.get.restore(); mock.manageConfigurationGroups.restore(); }); diff --git a/ambari-web/test/utils/host_progress_popup_test.js b/ambari-web/test/utils/host_progress_popup_test.js index 23ccf37..6fb8889 100644 --- a/ambari-web/test/utils/host_progress_popup_test.js +++ b/ambari-web/test/utils/host_progress_popup_test.js @@ -316,12 +316,6 @@ describe('App.HostPopup', function () { }); describe('#abortRequestSuccessCallback', function () { - beforeEach(function () { - sinon.spy(App.ModalPopup, 'show'); - }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); it('should open popup', function () { App.HostPopup.abortRequestSuccessCallback(null, null, { requestName: 'name', @@ -338,10 +332,8 @@ describe('App.HostPopup', function () { if (k === 'modalPopup') return null; return Em.get(App, k); }); - sinon.spy(App.ModalPopup, 'show'); }); afterEach(function () { - App.ModalPopup.show.restore(); App.ajax.get.restore(); }); it('should open popup', function () { diff --git a/ambari-web/test/utils/hosts_test.js b/ambari-web/test/utils/hosts_test.js index 0b20999..53b29d0 100644 --- a/ambari-web/test/utils/hosts_test.js +++ b/ambari-web/test/utils/hosts_test.js @@ -30,14 +30,6 @@ describe('hosts utils', function () { callback: Em.K }; - beforeEach(function () { - sinon.stub(App.ModalPopup, 'show', Em.K); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - describe('popup header and message', function () { var cases = [ @@ -3270,15 +3262,12 @@ describe('hosts utils', function () { describe('#setRackInfo', function () { beforeEach(function () { + App.ModalPopup.show.restore(); sinon.stub(App.ModalPopup, 'show', function (obj) { return Em.Object.create(obj); }); }); - afterEach(function () { - App.ModalPopup.show.restore(); - }); - describe('#bodyClass', function () { describe('#validation', function () { diff --git a/ambari-web/test/views/common/configs/config_versions_control_view_test.js b/ambari-web/test/views/common/configs/config_versions_control_view_test.js index eff49ae..eb93641 100644 --- a/ambari-web/test/views/common/configs/config_versions_control_view_test.js +++ b/ambari-web/test/views/common/configs/config_versions_control_view_test.js @@ -88,6 +88,7 @@ describe('App.ConfigVersionsControlView', function () { describe('#makeCurrent()', function () { beforeEach(function () { + App.ModalPopup.show.restore(); sinon.stub(App.ModalPopup, 'show', function (options) { options.onPrimary.call(Em.Object.create({ serviceConfigNote: 'note', @@ -97,7 +98,6 @@ describe('App.ConfigVersionsControlView', function () { sinon.stub(view, 'sendRevertCall', Em.K); }); afterEach(function () { - App.ModalPopup.show.restore(); view.sendRevertCall.restore(); }); it('context passed', function () { diff --git a/ambari-web/test/views/common/configs/service_config_view_test.js b/ambari-web/test/views/common/configs/service_config_view_test.js index 7cf9b4e..d508322 100644 --- a/ambari-web/test/views/common/configs/service_config_view_test.js +++ b/ambari-web/test/views/common/configs/service_config_view_test.js @@ -163,7 +163,6 @@ describe('App.ServiceConfigView', function () { describe('#save()', function () { beforeEach(function () { - sinon.spy(App.ModalPopup, 'show', Em.K); sinon.stub(App.ServiceConfigVersion, 'find').returns([ { serviceName: 'service', version: 1} ]); @@ -171,7 +170,6 @@ describe('App.ServiceConfigView', function () { }); afterEach(function () { - App.ModalPopup.show.restore(); App.ServiceConfigVersion.find.restore(); view.get('controller').saveStepConfigs.restore(); }); diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js index a5d4377..3ffa017 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_version_box_view_test.js @@ -269,11 +269,9 @@ describe('App.UpgradeVersionBoxView', function () { sinon.stub(App.RepositoryVersion, 'find').returns(Em.Object.create({ operatingSystems: [] })); - sinon.stub(App.ModalPopup, 'show', Em.K); }); afterEach(function () { App.RepositoryVersion.find.restore(); - App.ModalPopup.show.restore(); }); cases.forEach(function (item) { it(item.title, function () { @@ -327,6 +325,7 @@ describe('App.UpgradeVersionBoxView', function () { }) ] })); + App.ModalPopup.show.restore(); sinon.stub(App.ModalPopup, 'show', function (popupOptions) { var body = popupOptions.bodyClass.create(); return body.get('skipCheckBox').create({ @@ -340,7 +339,6 @@ describe('App.UpgradeVersionBoxView', function () { }); afterEach(function () { App.RepositoryVersion.find.restore(); - App.ModalPopup.show.restore(); }); cases.forEach(function (item) { it(item.title, function () { @@ -360,11 +358,9 @@ describe('App.UpgradeVersionBoxView', function () { beforeEach(function () { view.set('content.stackVersion', Em.Object.create({supportsRevert: false})); view.set('content.stackServices', [Em.Object.create({isUpgradable: true})]) - sinon.spy(App.ModalPopup, 'show'); sinon.stub(view, 'filterHostsByStack', Em.K); }); afterEach(function () { - App.ModalPopup.show.restore(); view.filterHostsByStack.restore(); }); it("no hosts", function () { diff --git a/ambari-web/test/views/main/dashboard/widget_test.js b/ambari-web/test/views/main/dashboard/widget_test.js index f63ec00..1d18e42 100644 --- a/ambari-web/test/views/main/dashboard/widget_test.js +++ b/ambari-web/test/views/main/dashboard/widget_test.js @@ -167,15 +167,6 @@ describe('App.DashboardWidgetView', function () { }); describe('#editWidget()', function() { - - beforeEach(function() { - sinon.stub(App.ModalPopup, 'show'); - }); - - afterEach(function() { - App.ModalPopup.show.restore(); - }); - it('App.ModalPopup.show should be called', function() { view.editWidget(); expect(App.ModalPopup.show).to.be.calledOnce; diff --git a/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js b/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js index 50f5f7b..3b683c9 100644 --- a/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js +++ b/ambari-web/test/views/wizard/step3/hostWarningPopupBody_view_test.js @@ -53,15 +53,6 @@ describe('App.WizardStep3HostWarningPopupBody', function() { }); describe('#showHostsPopup', function() { - - beforeEach(function () { - sinon.stub(App.ModalPopup, 'show', Em.K); - }); - - afterEach(function () { - App.ModalPopup.show.restore(); - }); - it('should call App.ModalPopup.show', function() { view.showHostsPopup({context: []}); expect(App.ModalPopup.show.calledOnce).to.equal(true);