ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [23/50] [abbrv] ambari git commit: AMBARI-14515. Improve Ambari UI UT (p.3) (onechiporenko)
Date Mon, 04 Jan 2016 21:38:16 GMT
AMBARI-14515. Improve Ambari UI UT (p.3) (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a487e501
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a487e501
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a487e501

Branch: refs/heads/branch-dev-patch-upgrade
Commit: a487e5018d320bb0943df0a27fcd6242e084ff80
Parents: 376fc6f
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Tue Dec 29 11:55:40 2015 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Dec 29 15:13:47 2015 +0200

----------------------------------------------------------------------
 ambari-web/test/app_test.js                     |  47 +-
 .../global/cluster_controller_test.js           | 160 +++--
 .../global/update_controller_test.js            |  13 +-
 ambari-web/test/controllers/installer_test.js   | 208 ++++--
 .../progress_popup_controller_test.js           | 111 +++-
 .../resourceManager/step3_controller_test.js    |  38 +-
 .../admin/highAvailability_controller_test.js   | 166 +++--
 .../admin/kerberos/step2_controller_test.js     |  30 +-
 .../admin/kerberos/step4_controller_test.js     |  23 +-
 .../admin/kerberos/step6_controller_test.js     |  22 +-
 .../controllers/main/admin/kerberos_test.js     | 102 ++-
 .../admin/stack_and_upgrade_controller_test.js  | 390 +++++++----
 .../definitions_configs_controller_test.js      |  63 +-
 ...anage_alert_notifications_controller_test.js |  31 +-
 .../heatmap_metrics/heatmap_metric_test.js      | 109 ++-
 .../controllers/main/charts/heatmap_test.js     |  22 +-
 .../dashboard/config_history_controller_test.js |  20 +-
 .../main/host/configs_service_test.js           |  16 +-
 .../test/controllers/main/host/details_test.js  | 656 ++++++++++++-------
 .../main/service/add_controller_test.js         | 109 ++-
 .../main/service/info/config_test.js            |  94 ++-
 .../test/controllers/main/service/item_test.js  | 141 ++--
 .../manage_config_groups_controller_test.js     | 137 +++-
 .../service/reassign/step1_controller_test.js   |  28 +-
 .../service/reassign/step4_controller_test.js   |  32 +-
 .../main/service/reassign_controller_test.js    |  16 +-
 .../widgets/create/step2_controller_test.js     | 302 ++++++---
 .../test/controllers/main/service_test.js       |  78 ++-
 .../controllers/main/views_controller_test.js   |   5 +-
 ambari-web/test/controllers/main_test.js        |  18 +-
 ambari-web/test/router_test.js                  |  38 +-
 31 files changed, 2202 insertions(+), 1023 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index dea2464..972f57f 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -103,12 +103,22 @@ describe('App', function () {
     ];
 
     testCases.forEach(function (test) {
-      it(test.title, function () {
-        sinon.stub(App.Service, 'find', function () {
-          return test.service;
+      describe(test.title, function () {
+
+        beforeEach(function () {
+          sinon.stub(App.Service, 'find', function () {
+            return test.service;
+          });
+        });
+
+        afterEach(function () {
+          App.Service.find.restore();
         });
-        expect(App.get('falconServerURL')).to.equal(test.result);
-        App.Service.find.restore();
+
+        it('App.falconServerURL is ' + test.result, function () {
+          expect(App.get('falconServerURL')).to.equal(test.result);
+        });
+
       });
     });
   });
@@ -219,19 +229,42 @@ describe('App', function () {
       })
     ];
 
-    it('distribute services by categories', function () {
+    beforeEach(function () {
       sinon.stub(App.StackService, 'find', function () {
         return stackServices;
       });
+    });
+
+    afterEach(function () {
+      App.StackService.find.restore();
+    });
 
+    it('App.services.all', function () {
       expect(App.get('services.all')).to.eql(['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7']);
+    });
+
+    it('App.services.clientOnly', function () {
       expect(App.get('services.clientOnly')).to.eql(['S1']);
+    });
+
+    it('App.services.hasClient', function () {
       expect(App.get('services.hasClient')).to.eql(['S2']);
+    });
+
+    it('App.services.hasMaster', function () {
       expect(App.get('services.hasMaster')).to.eql(['S3']);
+    });
+
+    it('App.services.hasSlave', function () {
       expect(App.get('services.hasSlave')).to.eql(['S4']);
+    });
+
+    it('App.services.noConfigTypes', function () {
       expect(App.get('services.noConfigTypes')).to.eql(['S5']);
+    });
+
+    it('App.services.monitoring', function () {
       expect(App.get('services.monitoring')).to.eql(['S6']);
-      App.StackService.find.restore();
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/global/cluster_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index c2f3498..a020b46 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -202,6 +202,7 @@ describe('App.clusterController', function () {
   });
 
   describe("#createKerberosAdminSession()", function() {
+
     beforeEach(function () {
       sinon.stub(App.ajax, 'send', function() {
         return {success: Em.K}
@@ -209,21 +210,24 @@ describe('App.clusterController', function () {
       sinon.stub(credentialUtils, 'createOrUpdateCredentials', function() {
         return $.Deferred().resolve().promise();
       });
+      this.stub = sinon.stub(App, 'get');
+      this.stub.withArgs('clusterName').returns('test');
     });
+
     afterEach(function () {
       App.ajax.send.restore();
       credentialUtils.createOrUpdateCredentials.restore();
+      App.get.restore();
     });
+
     it("KDC Store supports disabled, credentials updated via kdc session call", function() {
-      sinon.stub(App, 'get')
-        .withArgs('supports.storeKDCCredentials').returns(false)
-        .withArgs('clusterName').returns('test');
+      this.stub.withArgs('supports.storeKDCCredentials').returns(false);
       controller.createKerberosAdminSession({
         principal: 'admin',
         key: 'pass',
         type: 'persistent'
       }, {});
-      App.get.restore();
+
       expect(App.ajax.send.getCall(0).args[0]).to.eql({
         name: 'common.cluster.update',
         sender: controller,
@@ -238,15 +242,12 @@ describe('App.clusterController', function () {
       });
     });
     it("KDC Store supports enabled, credentials updated via credentials storage call", function() {
-      sinon.stub(App, 'get')
-        .withArgs('supports.storeKDCCredentials').returns(true)
-        .withArgs('clusterName').returns('test');
+      this.stub.withArgs('supports.storeKDCCredentials').returns(true);
       controller.createKerberosAdminSession({
         principal: 'admin',
         key: 'pass',
         type: 'persistent'
       }, {});
-      App.get.restore();
       expect(App.ajax.send.called).to.be.eql(false);
       expect(credentialUtils.createOrUpdateCredentials.getCall(0).args).to.eql([
         'test', 'kdc.admin.credential', {
@@ -292,20 +293,36 @@ describe('App.clusterController', function () {
       App.get.restore();
     });
 
-    it('should check detailed repo version for HDP 2.2', function () {
-      sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP').withArgs('currentStackVersionNumber').returns('2.2');
-      controller.checkDetailedRepoVersion();
-      expect(App.ajax.send.calledOnce).to.be.true;
+    describe('should check detailed repo version for HDP 2.2', function () {
+
+      beforeEach(function () {
+        sinon.stub(App, 'get').withArgs('currentStackName').returns('HDP').withArgs('currentStackVersionNumber').returns('2.2');
+      });
+
+      it('request is sent', function () {
+        controller.checkDetailedRepoVersion();
+        expect(App.ajax.send.calledOnce).to.be.true;
+      });
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        sinon.stub(App, 'get', function (key) {
-          return item[key] || Em.get(App, key);
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          sinon.stub(App, 'get', function (key) {
+            return item[key] || Em.get(App, key);
+          });
+          controller.checkDetailedRepoVersion();
         });
-        controller.checkDetailedRepoVersion();
-        expect(App.ajax.send.called).to.be.false;
-        expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+
+        it('request is not sent', function () {
+          expect(App.ajax.send.called).to.be.false;
+        });
+
+        it('App.isStormMetricsSupported is ' + item.isStormMetricsSupported, function () {
+          expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+        });
+
       });
     });
 
@@ -438,14 +455,18 @@ describe('App.clusterController', function () {
 
   describe("#restoreUpgradeState()", function() {
     var data = {upgradeData: {}};
-    var mock = {done: function(callback) {
-      callback(data.upgradeData);
-    }};
+    var mock = {
+      done: function (callback) {
+        callback(data.upgradeData);
+      }
+    };
     var upgradeController = Em.Object.create({
       restoreLastUpgrade: Em.K,
       initDBProperties: Em.K,
       loadUpgradeData: Em.K,
-      loadStackVersionsToModel: function(){return {done: Em.K};}
+      loadStackVersionsToModel: function () {
+        return {done: Em.K};
+      }
     });
 
     beforeEach(function () {
@@ -458,6 +479,7 @@ describe('App.clusterController', function () {
       sinon.spy(upgradeController, 'loadUpgradeData');
       sinon.spy(upgradeController, 'loadStackVersionsToModel');
     });
+
     afterEach(function () {
       mock.done.restore();
       controller.getAllUpgrades.restore();
@@ -468,31 +490,77 @@ describe('App.clusterController', function () {
       upgradeController.loadUpgradeData.restore();
       upgradeController.loadStackVersionsToModel.restore();
     });
-    it("has upgrade request", function() {
-      data.upgradeData = {items: [
-        {
-          Upgrade: {
-            request_id: 1
+
+    describe("has upgrade request", function() {
+
+      beforeEach(function () {
+        data.upgradeData = {items: [
+          {
+            Upgrade: {
+              request_id: 1
+            }
           }
-        }
-      ]};
-      controller.restoreUpgradeState();
-      expect(controller.getAllUpgrades.calledOnce).to.be.true;
-      expect(App.get('upgradeState')).to.equal('PENDING');
-      expect(upgradeController.restoreLastUpgrade.calledWith(data.upgradeData.items[0])).to.be.true;
-      expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
-      expect(upgradeController.initDBProperties.called).to.be.false;
-      expect(upgradeController.loadUpgradeData.called).to.be.false;
-    });
-    it("does not have upgrade request", function() {
-      data.upgradeData = {items: []};
-      controller.restoreUpgradeState();
-      expect(controller.getAllUpgrades.calledOnce).to.be.true;
-      expect(App.get('upgradeState')).to.equal('PENDING');
-      expect(upgradeController.restoreLastUpgrade.called).to.be.false;
-      expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
-      expect(upgradeController.initDBProperties.calledOnce).to.be.true;
-      expect(upgradeController.loadUpgradeData.calledWith(true)).to.be.true;
+        ]};
+        controller.restoreUpgradeState();
+      });
+
+      it('getAllUpgrades is called once', function () {
+        expect(controller.getAllUpgrades.calledOnce).to.be.true;
+      });
+
+      it('upgradeState is PENDING', function () {
+        expect(App.get('upgradeState')).to.equal('PENDING');
+      });
+
+      it('restoreLastUpgrade is called with valid arguments', function () {
+        expect(upgradeController.restoreLastUpgrade.calledWith(data.upgradeData.items[0])).to.be.true;
+      });
+
+      it('loadStackVersionsToModel is called with valid arguments', function () {
+        expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
+      });
+
+      it('initDBProperties is not called', function () {
+        expect(upgradeController.initDBProperties.called).to.be.false;
+      });
+
+      it('loadUpgradeData is not called', function () {
+        expect(upgradeController.loadUpgradeData.called).to.be.false;
+      });
+
+    });
+
+    describe("does not have upgrade request", function() {
+
+      beforeEach(function () {
+        data.upgradeData = {items: []};
+        controller.restoreUpgradeState();
+      });
+
+      it('getAllUpgrades is called once', function () {
+        expect(controller.getAllUpgrades.calledOnce).to.be.true;
+      });
+
+      it('upgradeState is PENDING', function () {
+        expect(App.get('upgradeState')).to.equal('PENDING');
+      });
+
+      it('restoreLastUpgrade is not called', function () {
+        expect(upgradeController.restoreLastUpgrade.called).to.be.false;
+      });
+
+      it('loadStackVersionsToModel is called with valid arguments', function () {
+        expect(upgradeController.loadStackVersionsToModel.calledWith(true)).to.be.true;
+      });
+
+      it('initDBProperties is called once', function () {
+        expect(upgradeController.initDBProperties.calledOnce).to.be.true;
+      });
+
+      it('loadUpgradeData is called with valid arguments', function () {
+        expect(upgradeController.loadUpgradeData.calledWith(true)).to.be.true;
+      });
+
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index 807d99d..010e30a 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -34,18 +34,19 @@ describe('App.UpdateController', function () {
 
   describe('#getUrl()', function () {
 
-    it('testMode = true', function () {
-      App.set('testMode', true);
-      expect(controller.getUrl('test', '/real')).to.equal('test');
+    beforeEach(function () {
+      sinon.stub(App, 'get').withArgs('testMode').returns(false);
+    });
+
+    afterEach(function () {
+      App.get.restore();
     });
 
     it('testMode = false', function () {
-      App.set('testMode', false);
       expect(controller.getUrl('test', '/real')).to.equal('/api/v1/clusters//real');
     });
 
-    it('testMode = false', function () {
-      App.set('testMode', false);
+    it('testMode = false (2)', function () {
       controller.set('clusterName', 'mycluster');
       expect(controller.getUrl('test', '/real')).to.equal('/api/v1/clusters/mycluster/real');
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 06d4ca7..65b911c 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -462,17 +462,25 @@ describe('App.InstallerController', function () {
   });
 
   describe('#loadMap', function() {
-    it ('Should load cluster', function() {
+
+    describe('Should load cluster', function() {
       var loadCluster = false;
       var checker = {
         load: function() {
           loadCluster = true;
         }
       };
-      installerController.loadMap['0'][0].callback.call(checker);
-      expect(loadCluster).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['0'][0].callback.call(checker);
+      });
+
+      it('cluster info is loaded', function () {
+        expect(loadCluster).to.be.true;
+      });
     });
-    it ('Should load stacks', function() {
+
+    describe('Should load stacks', function() {
       var loadStacks = false;
       var checker = {
         loadStacks: function() {
@@ -483,52 +491,84 @@ describe('App.InstallerController', function () {
           };
         }
       };
-      installerController.loadMap['1'][0].callback.call(checker);
-      expect(loadStacks).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['1'][0].callback.call(checker);
+      });
+
+      it('stack info is loaded', function () {
+        expect(loadStacks).to.be.true;
+      });
     });
-    it ('Should load stacks async', function() {
+
+    describe ('Should load stacks async', function() {
       var loadStacksVersions = false;
       var checker = {
         loadStacksVersions: function() {
           loadStacksVersions = true;
         }
       };
-      installerController.loadMap['1'][1].callback.call(checker, true).then(function(data){
-        expect(data).to.be.true;
+
+      it('stack versions are loaded', function () {
+        installerController.loadMap['1'][1].callback.call(checker, true).then(function(data){
+          expect(data).to.be.true;
+        });
+        expect(loadStacksVersions).to.be.false;
       });
-      expect(loadStacksVersions).to.be.false;
     });
-    it ('Should load installOptions', function() {
-      var loadStacks = false;
+
+    describe('Should load installOptions', function() {
+      var installOptions = false;
       var checker = {
         load: function() {
-          loadStacks = true;
+          installOptions = true;
         }
       };
-      installerController.loadMap['2'][0].callback.call(checker);
-      expect(loadStacks).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['2'][0].callback.call(checker);
+      });
+
+      it('install option are loaded', function () {
+        expect(installOptions).to.be.true;
+      });
     });
-    it ('Should load loadConfirmedHosts', function() {
+
+    describe('Should load loadConfirmedHosts', function() {
       var loadConfirmedHosts = false;
       var checker = {
         loadConfirmedHosts: function() {
           loadConfirmedHosts = true;
         }
       };
-      installerController.loadMap['3'][0].callback.call(checker);
-      expect(loadConfirmedHosts).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['3'][0].callback.call(checker);
+      });
+
+      it('confirmed hosts are loaded', function () {
+        expect(loadConfirmedHosts).to.be.true;
+      });
     });
-    it ('Should load loadServices', function() {
+
+    describe('Should load loadServices', function() {
       var loadServices = false;
       var checker = {
         loadServices: function() {
           loadServices = true;
         }
       };
-      installerController.loadMap['4'][0].callback.call(checker);
-      expect(loadServices).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['4'][0].callback.call(checker);
+      });
+
+      it('services are loaded', function () {
+        expect(loadServices).to.be.true;
+      });
     });
-    it ('Should load loadServices', function() {
+
+    describe('Should load loadServices (2)', function() {
       var setSkipSlavesStep = false;
       var loadMasterComponentHosts = false;
       var loadConfirmedHosts = false;
@@ -548,14 +588,30 @@ describe('App.InstallerController', function () {
           loadRecommendations = true;
         }
       };
-      installerController.loadMap['5'][0].callback.call(checker);
-      expect(loadConfirmedHosts).to.be.true;
-      expect(setSkipSlavesStep).to.be.true;
-      expect(loadMasterComponentHosts).to.be.true;
-      expect(loadRecommendations).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['5'][0].callback.call(checker);
+      });
+
+      it('confirmed hosts are loaded', function() {
+        expect(loadConfirmedHosts).to.be.true;
+      });
+
+      it('`skipSlavesStep` is loaded', function() {
+        expect(setSkipSlavesStep).to.be.true;
+      });
+
+      it('master components hosts are loaded', function() {
+        expect(loadMasterComponentHosts).to.be.true;
+      });
+
+      it('recommendations are loaded', function() {
+        expect(loadRecommendations).to.be.true;
+      });
 
     });
-    it ('Should load serviceConfigGroups', function() {
+
+    describe ('Should load serviceConfigGroups', function() {
       var loadServiceConfigGroups = false;
       var loadServiceConfigProperties = false;
       var loadCurrentHostGroups = false;
@@ -579,14 +635,34 @@ describe('App.InstallerController', function () {
           loadConfigThemes = true;
         }
       };
-      installerController.loadMap['7'][0].callback.call(checker);
-      expect(loadServiceConfigGroups).to.be.true;
-      expect(loadServiceConfigProperties).to.be.true;
-      expect(loadCurrentHostGroups).to.be.true;
-      expect(loadRecommendationsConfigs).to.be.true;
-      expect(loadConfigThemes).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['7'][0].callback.call(checker);
+      });
+
+      it('config groups are loaded', function () {
+        expect(loadServiceConfigGroups).to.be.true;
+      });
+
+      it('config properties are loaded', function () {
+        expect(loadServiceConfigProperties).to.be.true;
+      });
+
+      it('current host groups are loaded', function () {
+        expect(loadCurrentHostGroups).to.be.true;
+      });
+
+      it('recommendations are loaded', function () {
+        expect(loadRecommendationsConfigs).to.be.true;
+      });
+
+      it('config themes are loaded', function () {
+        expect(loadConfigThemes).to.be.true;
+      });
+
     });
-    it ('Should load clients', function() {
+
+    describe('Should load clients', function() {
       var loadSlaveComponentHosts = false;
       var loadClients = false;
       var loadRecommendations = false;
@@ -602,11 +678,25 @@ describe('App.InstallerController', function () {
           loadRecommendations = true;
         }
       };
-      installerController.loadMap['6'][0].callback.call(checker);
-      expect(loadSlaveComponentHosts).to.be.true;
-      expect(loadClients).to.be.true;
-      expect(loadRecommendations).to.be.true;
+
+      beforeEach(function () {
+        installerController.loadMap['6'][0].callback.call(checker);
+      });
+
+      it('slave components hosts are loaded', function () {
+        expect(loadSlaveComponentHosts).to.be.true;
+      });
+
+      it('clients are loaded', function () {
+        expect(loadClients).to.be.true;
+      });
+
+      it('recommendations are loaded', function () {
+        expect(loadRecommendations).to.be.true;
+      });
+
     });
+
   });
 
   describe('#removeHosts', function() {
@@ -1121,18 +1211,34 @@ describe('App.InstallerController', function () {
     ];
 
     tests.forEach(function(test) {
-      it(test.m, function() {
-        sinon.stub(App.Stack, 'find').returns(test.stacks);
-        sinon.stub(App.router, 'get').withArgs('clusterController.isCustomJDK').returns(test.isCustomJDK)
-          .withArgs('clusterController.ambariProperties').returns(test.ambariProperties);
-        sinon.stub(App, 'showConfirmationPopup', Em.K);
-        var successCallback = sinon.spy();
-        installerController.validateJDKVersion(successCallback);
-        expect(successCallback.called).to.be.eql(test.successCallbackCalled);
-        expect(App.showConfirmationPopup.called).to.be.eql(test.popupCalled);
-        App.router.get.restore();
-        App.Stack.find.restore();
-        App.showConfirmationPopup.restore();
+
+      describe(test.m, function() {
+
+        var successCallback;
+
+        beforeEach(function ()  {
+          sinon.stub(App.Stack, 'find').returns(test.stacks);
+          sinon.stub(App.router, 'get').withArgs('clusterController.isCustomJDK').returns(test.isCustomJDK)
+            .withArgs('clusterController.ambariProperties').returns(test.ambariProperties);
+          sinon.stub(App, 'showConfirmationPopup', Em.K);
+          successCallback = sinon.spy();
+          installerController.validateJDKVersion(successCallback);
+        });
+
+        afterEach(function () {
+          App.router.get.restore();
+          App.Stack.find.restore();
+          App.showConfirmationPopup.restore();
+        });
+
+        it('successCallback is ' + (test.successCallbackCalled ? '' : 'not') + ' called', function () {
+          expect(successCallback.called).to.be.equal(test.successCallbackCalled);
+        });
+
+        it('App.showConfirmationPopup. is ' + (test.popupCalled ? '' : 'not') + ' called', function () {
+          expect(App.showConfirmationPopup.called).to.be.equal(test.popupCalled);
+        });
+
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js
----------------------------------------------------------------------
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 bd8deb3..2a9a4d7 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
@@ -44,13 +44,32 @@ describe('App.HighAvailabilityProgressPopupController', function () {
       App.updater.immediateRun.restore();
     });
 
-    it('should start task polling', function () {
-      controller.startTaskPolling(1, 2);
-      expect(controller.get('isTaskPolling')).to.be.true;
-      expect(controller.get('taskInfo.id'), 2);
-      expect(controller.get('taskInfo.requestId'), 1);
-      expect(App.updater.run.calledOnce).to.be.true;
-      expect(App.updater.immediateRun.calledOnce).to.be.true;
+    describe('should start task polling', function () {
+
+      beforeEach(function () {
+        controller.startTaskPolling(1, 2);
+      });
+
+      it('isTaskPolling = true', function () {
+        expect(controller.get('isTaskPolling')).to.be.true;
+      });
+
+      it('taskInfo.id = 2', function () {
+        expect(controller.get('taskInfo.id'), 2);
+      });
+
+      it('taskInfo.requestId = 1', function () {
+        expect(controller.get('taskInfo.requestId'), 1);
+      });
+
+      it('App.updater.run is called once', function () {
+        expect(App.updater.run.calledOnce).to.be.true;
+      });
+
+      it('App.updater.immediateRun is called once', function () {
+        expect(App.updater.immediateRun.calledOnce).to.be.true;
+      });
+
     });
 
   });
@@ -125,17 +144,36 @@ describe('App.HighAvailabilityProgressPopupController', function () {
 
     cases.forEach(function (item) {
       var message = title.format(item.isTaskPolling ? '' : 'not ', item.status);
-      it(message, function () {
-        controller.updateTaskSuccessCallback({
-          Tasks: $.extend(tasks, {
-            status: item.status
-          })
+      describe(message, function () {
+
+        beforeEach(function () {
+          controller.updateTaskSuccessCallback({
+            Tasks: $.extend(tasks, {
+              status: item.status
+            })
+          });
         });
-        expect(controller.get('taskInfo.stderr')).to.equal('error');
-        expect(controller.get('taskInfo.stdout')).to.equal('output');
-        expect(controller.get('taskInfo.outputLog')).to.equal('output-log.txt');
-        expect(controller.get('taskInfo.errorLog')).to.equal('error-log.txt');
-        expect(controller.get('isTaskPolling')).to.equal(item.isTaskPolling);
+
+        it('stderr is valid', function () {
+          expect(controller.get('taskInfo.stderr')).to.equal('error');
+        });
+
+        it('stdout is valid', function () {
+          expect(controller.get('taskInfo.stdout')).to.equal('output');
+        });
+
+        it('outputLog is valid', function () {
+          expect(controller.get('taskInfo.outputLog')).to.equal('output-log.txt');
+        });
+
+        it('errorLog is valid', function () {
+          expect(controller.get('taskInfo.errorLog')).to.equal('error-log.txt');
+        });
+
+        it('isTaskPolling is valid', function () {
+          expect(controller.get('isTaskPolling')).to.equal(item.isTaskPolling);
+        });
+
       });
     });
 
@@ -171,17 +209,36 @@ describe('App.HighAvailabilityProgressPopupController', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        controller.setProperties({
-          requestIds: [1, 2],
-          stageId: item.stageId
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          controller.setProperties({
+            requestIds: [1, 2],
+            stageId: item.stageId
+          });
+          controller.getHosts();
+        });
+
+        it('two requests are sent', function () {
+          expect(App.ajax.send.calledTwice).to.be.true;
         });
-        controller.getHosts();
-        expect(App.ajax.send.calledTwice).to.be.true;
-        expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name);
-        expect(App.ajax.send.secondCall.args[0].name).to.equal(item.name);
-        expect(App.ajax.send.firstCall.args[0].data.stageId).to.eql(item.stageIdPassed);
-        expect(App.ajax.send.secondCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+
+        it('1st call name is valid', function () {
+          expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name);
+        });
+
+        it('2nd call name is valid', function () {
+          expect(App.ajax.send.secondCall.args[0].name).to.equal(item.name);
+        });
+
+        it('1st stageId is valid', function () {
+          expect(App.ajax.send.firstCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+        });
+
+        it('2nd stageId is valid', function () {
+          expect(App.ajax.send.secondCall.args[0].data.stageId).to.eql(item.stageIdPassed);
+        });
+
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
index fedcb8e..5b34dd4 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
@@ -295,35 +295,59 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
           })
         ];
       });
+      controller.setDynamicConfigValues(configs, data);
     });
 
     afterEach(function () {
       App.HostComponent.find.restore();
     });
 
-    it('setting new RM properties values', function () {
-      controller.setDynamicConfigValues(configs, data);
+    it('yarn.resourcemanager.hostname.rm1 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('value')).to.equal('h0');
+    });
+    it('yarn.resourcemanager.hostname.rm1 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('recommendedValue')).to.equal('h0');
+    });
+    it('yarn.resourcemanager.hostname.rm2 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('value')).to.equal('h1');
+    });
+    it('yarn.resourcemanager.hostname.rm2 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('recommendedValue')).to.equal('h1');
-
+    });
+    it('yarn.resourcemanager.webapp.address.rm1 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('value')).to.equal('h0:1234');
+    });
+    it('yarn.resourcemanager.webapp.address.rm1 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm1').get('recommendedValue')).to.equal('h0:1234');
+    });
+    it('yarn.resourcemanager.webapp.address.rm2 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('value')).to.equal('h1:1234');
+    });
+    it('yarn.resourcemanager.webapp.address.rm2 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.address.rm2').get('recommendedValue')).to.equal('h1:1234');
-
+    });
+    it('yarn.resourcemanager.webapp.https.address.rm1 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('value')).to.equal('h0:4321');
+    });
+    it('yarn.resourcemanager.webapp.https.address.rm1 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm1').get('recommendedValue')).to.equal('h0:4321');
+    });
+    it('yarn.resourcemanager.webapp.https.address.rm2 value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('value')).to.equal('h1:4321');
+    });
+    it('yarn.resourcemanager.webapp.https.address.rm2 recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.webapp.https.address.rm2').get('recommendedValue')).to.equal('h1:4321');
-
+    });
+    it('yarn.resourcemanager.zk-address value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('value')).to.equal('h2:2222,h3:2222');
+    });
+    it('yarn.resourcemanager.zk-address recommendedValue', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('recommendedValue')).to.equal('h2:2222,h3:2222');
     });
-
-    it('Setting new HAWQ RM properties values', function () {
+    it('yarn.resourcemanager.ha value', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.ha').get('value')).to.equal('h0:8032,h1:8032');
+    });
+    it('yarn.resourcemanager.ha recommendedValud', function () {
       expect(configs.configs.findProperty('name', 'yarn.resourcemanager.scheduler.ha').get('recommendedValue')).to.equal('h0:8030,h1:8030');
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
index 0a75d9f..1e3d140 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability_controller_test.js
@@ -38,40 +38,51 @@ describe('App.MainAdminHighAvailabilityController', function () {
       });
       sinon.spy(controller, "showErrorPopup");
     });
+
     afterEach(function () {
       App.router.transitionTo.restore();
       controller.showErrorPopup.restore();
       App.HostComponent.find.restore();
+      App.router.get.restore();
     });
 
-    it('NAMENODE in INSTALLED state', function () {
-      hostComponents = [
-        Em.Object.create({
-          componentName: 'NAMENODE',
-          workStatus: 'INSTALLED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        })
-      ];
+    describe('NAMENODE in INSTALLED state', function () {
+      beforeEach(function () {
+        hostComponents = [
+          Em.Object.create({
+            componentName: 'NAMENODE',
+            workStatus: 'INSTALLED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          })
+        ];
+        sinon.stub(App.router, 'get', function() {
+          return 3;
+        });
+        this.result = controller.enableHighAvailability();
+      });
 
-      sinon.stub(App.router, 'get', function(){
-        return 3;
+      it('enableHighAvailability result is false', function () {
+        expect(this.result).to.be.false;
       });
-      expect(controller.enableHighAvailability()).to.be.false;
-      expect(controller.showErrorPopup.calledOnce).to.be.true;
-      App.router.get.restore();
+
+      it('showErrorPopup is called once', function () {
+        expect(controller.showErrorPopup.calledOnce).to.be.true;
+      });
+
     });
-    it('Cluster has less than 3 ZOOKEPER_SERVER components', function () {
+
+    describe('Cluster has less than 3 ZOOKEPER_SERVER components', function () {
       hostComponents = [
         Em.Object.create({
           componentName: 'NAMENODE',
@@ -79,14 +90,24 @@ describe('App.MainAdminHighAvailabilityController', function () {
         })
       ];
 
-      sinon.stub(App.router, 'get', function(){
-        return 3;
+      beforeEach(function () {
+        sinon.stub(App.router, 'get', function(){
+          return 3;
+        });
+        this.result = controller.enableHighAvailability();
       });
-      expect(controller.enableHighAvailability()).to.be.false;
-      expect(controller.showErrorPopup.called).to.be.true;
-      App.router.get.restore();
+
+      it('enableHighAvailability result is false', function () {
+        expect(this.result).to.be.false;
+      });
+
+      it('showErrorPopup is called', function () {
+        expect(controller.showErrorPopup.called).to.be.true;
+      });
+
     });
-    it('total hosts number less than 3', function () {
+
+    describe('total hosts number less than 3', function () {
       hostComponents = [
         Em.Object.create({
           componentName: 'NAMENODE',
@@ -105,39 +126,62 @@ describe('App.MainAdminHighAvailabilityController', function () {
           workStatus: 'INSTALLED'
         })
       ];
-      sinon.stub(App.router, 'get', function () {
-        return 1;
+
+      beforeEach(function () {
+        sinon.stub(App.router, 'get', function () {
+          return 1;
+        });
+        this.result = controller.enableHighAvailability();
       });
-      expect(controller.enableHighAvailability()).to.be.false;
-      expect(controller.showErrorPopup.calledOnce).to.be.true;
-      App.router.get.restore();
+
+      it('enableHighAvailability result is false', function () {
+        expect(this.result).to.be.false;
+      });
+
+      it('showErrorPopup is called once', function () {
+        expect(controller.showErrorPopup.calledOnce).to.be.true;
+      });
+
     });
-    it('All checks passed', function () {
-      hostComponents = [
-        Em.Object.create({
-          componentName: 'NAMENODE',
-          workStatus: 'STARTED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        }),
-        Em.Object.create({
-          componentName: 'ZOOKEEPER_SERVER',
-          workStatus: 'INSTALLED'
-        })
-      ];
-      sinon.stub(App.router, 'get', function(){
-        return 3;
+
+    describe('All checks passed', function () {
+      beforeEach(function () {
+        hostComponents = [
+          Em.Object.create({
+            componentName: 'NAMENODE',
+            workStatus: 'STARTED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          }),
+          Em.Object.create({
+            componentName: 'ZOOKEEPER_SERVER',
+            workStatus: 'INSTALLED'
+          })
+        ];
+        sinon.stub(App.router, 'get', function() {
+          return 3;
+        });
+        this.result = controller.enableHighAvailability();
       });
-      expect(controller.enableHighAvailability()).to.be.true;
-      expect(App.router.transitionTo.calledWith('main.services.enableHighAvailability')).to.be.true;
-      expect(controller.showErrorPopup.calledOnce).to.be.false;
-      App.router.get.restore();
+
+      it('enableHighAvailability result is true', function () {
+        expect(this.result).to.be.true;
+      });
+
+      it('user is moved to enable HA', function () {
+        expect(App.router.transitionTo.calledWith('main.services.enableHighAvailability')).to.be.true;
+      });
+
+      it('showErrorPopup is not called', function () {
+        expect(controller.showErrorPopup.calledOnce).to.be.false;
+      });
+
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
index c87c86c..275588d 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
@@ -79,17 +79,27 @@ describe('App.KerberosWizardStep2Controller', function() {
     ];
 
     tests.forEach(function(test) {
-      it('Should trim values for properties ' + Em.keys(test.e).join(','), function() {
-        sinon.stub(App.StackService, 'find').returns([Em.Object.create({serviceName: 'KERBEROS'})]);
-        controller.set('stepConfigs', [
-          App.ServiceConfig.create({
-            configs: test.stepConfigs.map(function(item) { return _createProperty(item[0], item[1], item[2]); })
-          })
-        ]);
-        var result = controller.createKerberosSiteObj('some-site', 'random-tag');
-        App.StackService.find.restore();
+      describe('Should trim values for properties ' + Em.keys(test.e).join(','), function() {
+        var result;
+
+        beforeEach(function () {
+          sinon.stub(App.StackService, 'find').returns([Em.Object.create({serviceName: 'KERBEROS'})]);
+          controller.set('stepConfigs', [
+            App.ServiceConfig.create({
+              configs: test.stepConfigs.map(function(item) { return _createProperty(item[0], item[1], item[2]); })
+            })
+          ]);
+          result = controller.createKerberosSiteObj('some-site', 'random-tag');
+        });
+
+        afterEach(function () {
+          App.StackService.find.restore();
+        });
+
         Em.keys(test.e).forEach(function(propertyName) {
-          expect(result.properties[propertyName]).to.be.eql(test.e[propertyName]);
+          it(propertyName, function () {
+            expect(result.properties[propertyName]).to.be.eql(test.e[propertyName]);
+          });
         });
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index 7b2f877..3f284f4 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -319,12 +319,23 @@ describe('App.KerberosWizardStep4Controller', function() {
       ];
 
       tests.forEach(function(test) {
-        it('Security {0} configure identities step should be {1}'.format(!!test.securityEnabled ? 'enabled' : 'disabled', !!test.stepSkipped ? 'skipped' : 'not skipped'), function() {
-          sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(test.securityEnabled);
-          this.wizardController.checkSecurityStatus();
-          App.get.restore();
-          controller.loadStep();
-          expect(App.router.send.calledWith('next')).to.be.eql(test.stepSkipped);
+        var message = 'Security {0} configure identities step should be {1}'.format(!!test.securityEnabled ? 'enabled' : 'disabled', !!test.stepSkipped ? 'skipped' : 'not skipped');
+        describe(message, function() {
+
+          beforeEach(function () {
+            sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(test.securityEnabled);
+            this.wizardController.checkSecurityStatus();
+            controller.loadStep();
+          });
+
+          afterEach(function () {
+            App.get.restore();
+          });
+
+          it('`send` is ' + (test.stepSkipped ? '' : 'not') + ' called with `next`', function () {
+            expect(App.router.send.calledWith('next')).to.be.eql(test.stepSkipped);
+          });
+
         });
       }, this);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js
index 780f896..8fe9bc2 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step6_controller_test.js
@@ -37,13 +37,21 @@ describe('App.KerberosWizardStep6Controller', function() {
     ];
 
     tests.forEach(function(test) {
-      it('YARN installed: {0}, ATS supported: {1} list of commands should be {2}'.format(test.yarnInstalled, test.doesATSSupportKerberos, test.commands.toString()), function () {
-        var controller = App.KerberosWizardStep6Controller.create({ commands: ['stopServices'] });
-        sinon.stub(App, 'get').withArgs('doesATSSupportKerberos').returns(test.doesATSSupportKerberos);
-        sinon.stub(App.Service, 'find').returns(test.yarnInstalled ? [Em.Object.create({serviceName: 'YARN'})] : []);
-        sinon.stub(App.HostComponent, 'find').returns(test.ATSInstalled ? [Em.Object.create({componentName: 'APP_TIMELINE_SERVER'})] : []);
-        controller.checkComponentsRemoval();
-        expect(controller.get('commands').toArray()).to.eql(test.commands);
+      var message = 'YARN installed: {0}, ATS supported: {1} list of commands should be {2}'.format(test.yarnInstalled, test.doesATSSupportKerberos, test.commands.toString());
+      describe(message, function () {
+        var controller;
+        beforeEach(function () {
+          controller = App.KerberosWizardStep6Controller.create({ commands: ['stopServices'] });
+          sinon.stub(App, 'get').withArgs('doesATSSupportKerberos').returns(test.doesATSSupportKerberos);
+          sinon.stub(App.Service, 'find').returns(test.yarnInstalled ? [Em.Object.create({serviceName: 'YARN'})] : []);
+          sinon.stub(App.HostComponent, 'find').returns(test.ATSInstalled ? [Em.Object.create({componentName: 'APP_TIMELINE_SERVER'})] : []);
+          controller.checkComponentsRemoval();
+        });
+
+        it('commands are valid', function () {
+          expect(controller.get('commands').toArray()).to.eql(test.commands);
+        });
+
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/kerberos_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js
index e05dfdb..d69e168 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -61,20 +61,30 @@ describe('App.MainAdminKerberosController', function() {
       });
     });
 
-    it('should take displayType from predefinedSiteProperties', function () {
-      sinon.stub(App.configsCollection, 'getAll').returns([
-        {
-          name: 'hadoop.security.auth_to_local',
-          displayType: 'multiLine'
-        }
-      ]);
-      expect(controller.prepareConfigProperties([
-        Em.Object.create({
-          name: 'hadoop.security.auth_to_local',
-          serviceName: 'HDFS'
-        })
-      ])[0].get('displayType')).to.equal('multiLine');
-      App.configsCollection.getAll.restore();
+    describe('should take displayType from predefinedSiteProperties', function () {
+
+      beforeEach(function () {
+        sinon.stub(App.configsCollection, 'getAll').returns([
+          {
+            name: 'hadoop.security.auth_to_local',
+            displayType: 'multiLine'
+          }
+        ]);
+      });
+
+      afterEach(function () {
+        App.configsCollection.getAll.restore();
+      });
+
+      it('displayType is valid', function () {
+        expect(controller.prepareConfigProperties([
+          Em.Object.create({
+            name: 'hadoop.security.auth_to_local',
+            serviceName: 'HDFS'
+          })
+        ])[0].get('displayType')).to.equal('multiLine');
+      });
+
     });
   });
 
@@ -227,17 +237,31 @@ describe('App.MainAdminKerberosController', function() {
         result: true
       }
     ].forEach(function (test) {
-          it(test.m, function () {
-            sinon.stub(App, 'get').returns(test.isKerberosEnabled);
-            controller.set('securityEnabled', test.securityEnabled);
-            controller.set('kdc_type', test.kdc_type);
-            controller.getKDCSessionState(mock.callback);
+          describe(test.m, function () {
+
+            beforeEach(function () {
+              sinon.stub(App, 'get').returns(test.isKerberosEnabled);
+              controller.set('securityEnabled', test.securityEnabled);
+              controller.set('kdc_type', test.kdc_type);
+              controller.getKDCSessionState(mock.callback);
+            });
+
+
             if (test.result) {
-              expect(mock.callback.calledOnce).to.be.false;
-              expect(App.ajax.send.calledOnce).to.be.true;
-            } else {
-              expect(mock.callback.calledOnce).to.be.true;
-              expect(App.ajax.send.calledOnce).to.be.false;
+              it('callback is not called', function () {
+                expect(mock.callback.calledOnce).to.be.false;
+              });
+              it('1 request is sent', function () {
+                expect(App.ajax.send.calledOnce).to.be.true;
+              });
+            }
+            else {
+              it('callback is called once', function () {
+                expect(mock.callback.calledOnce).to.be.true;
+              });
+              it('no request is sent', function () {
+                expect(App.ajax.send.calledOnce).to.be.false;
+              });
             }
           });
         });
@@ -281,17 +305,29 @@ describe('App.MainAdminKerberosController', function() {
         result: true
       }
     ].forEach(function (test) {
-          it(test.m, function () {
-            sinon.stub(App, 'get').returns(test.isKerberosEnabled);
-            controller.set('securityEnabled', test.securityEnabled);
-            controller.set('kdc_type', test.kdc_type);
-            controller.getSecurityType(mock.callback);
+          describe(test.m, function () {
+
+            beforeEach(function () {
+              sinon.stub(App, 'get').returns(test.isKerberosEnabled);
+              controller.set('securityEnabled', test.securityEnabled);
+              controller.set('kdc_type', test.kdc_type);
+              controller.getSecurityType(mock.callback);
+            });
+
             if (test.result) {
-              expect(mock.callback.calledOnce).to.be.false;
-              expect(App.ajax.send.calledOnce).to.be.true;
+              it('callback os not called', function () {
+                expect(mock.callback.calledOnce).to.be.false;
+              });
+              it('1 request is sent', function () {
+                expect(App.ajax.send.calledOnce).to.be.true;
+              });
             } else {
-              expect(mock.callback.calledOnce).to.be.true;
-              expect(App.ajax.send.calledOnce).to.be.false;
+              it('callback is called once', function () {
+                expect(mock.callback.calledOnce).to.be.true;
+              });
+              it('no request is sent', function () {
+                expect(App.ajax.send.calledOnce).to.be.false;
+              });
             }
           });
         });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
----------------------------------------------------------------------
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 392f899..2651437 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
@@ -523,15 +523,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#upgrade()", function() {
-    before(function () {
+    var callArgs;
+
+    beforeEach(function () {
       sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(controller, 'setDBProperty', Em.K);
-    });
-    after(function () {
-      App.ajax.send.restore();
-      controller.setDBProperty.restore();
-    });
-    it("make ajax call", function() {
       controller.set('currentVersion', {
         repository_version: '2.2'
       });
@@ -539,12 +535,30 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         value: '2.2',
         label: 'HDP-2.2'
       });
-      var callArgs = App.ajax.send.getCall(0).args[0];
+      callArgs = App.ajax.send.getCall(0).args[0];
+    });
+
+    afterEach(function () {
+      App.ajax.send.restore();
+      controller.setDBProperty.restore();
+    });
+
+    it("request-data is valid", function() {
       expect(callArgs.data).to.eql({"value": '2.2', "label": 'HDP-2.2'});
-      expect(callArgs.name).to.eql('admin.upgrade.start');
+    });
+    it('request-name is valid', function () {
+      expect(callArgs.name).to.equal('admin.upgrade.start');
+    });
+    it('request-sender is valid', function () {
       expect(callArgs.sender).to.eql(controller);
-      expect(callArgs.success).to.eql('upgradeSuccessCallback');
+    });
+    it('callback is valid', function () {
+      expect(callArgs.success).to.equal('upgradeSuccessCallback');
+    });
+    it('callback is called', function () {
       expect(callArgs.callback).to.be.called;
+    });
+    it('setDBProperty is called with valid data', function () {
       expect(controller.setDBProperty.calledWith('currentVersion', {
         repository_version: '2.2'
       })).to.be.true;
@@ -552,19 +566,12 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#upgradeSuccessCallback()", function() {
-    before(function () {
+
+    beforeEach(function () {
       sinon.stub(App.clusterStatus, 'setClusterStatus', Em.K);
       sinon.stub(controller, 'openUpgradeDialog', Em.K);
       sinon.stub(controller, 'setDBProperties', Em.K);
       sinon.stub(controller, 'load', Em.K);
-    });
-    after(function () {
-      App.clusterStatus.setClusterStatus.restore();
-      controller.openUpgradeDialog.restore();
-      controller.setDBProperties.restore();
-      controller.load.restore();
-    });
-    it("open upgrade dialog", function() {
       var data = {
         resources: [
           {
@@ -575,11 +582,31 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         ]
       };
       controller.upgradeSuccessCallback(data, {}, {label: 'HDP-2.2.1', isDowngrade: true});
+    });
+
+    afterEach(function () {
+      App.clusterStatus.setClusterStatus.restore();
+      controller.openUpgradeDialog.restore();
+      controller.setDBProperties.restore();
+      controller.load.restore();
+    });
+
+    it('load is called ocne', function() {
       expect(controller.load.calledOnce).to.be.true;
+    });
+    it('upgradeVersion is HDP-2.2.1', function() {
       expect(controller.get('upgradeVersion')).to.equal('HDP-2.2.1');
+    });
+    it('upgradeData is null', function() {
       expect(controller.get('upgradeData')).to.be.null;
+    });
+    it('isDowngrade is true', function() {
       expect(controller.get('isDowngrade')).to.be.true;
+    });
+    it('App.clusterStatus.setClusterStatus is called once', function() {
       expect(App.clusterStatus.setClusterStatus.calledOnce).to.be.true;
+    });
+    it('controller.openUpgradeDialog is called once', function() {
       expect(controller.openUpgradeDialog.calledOnce).to.be.true;
     });
   });
@@ -678,22 +705,46 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         groups = controller.get('upgradeData.upgradeGroups');
       });
 
-      it("checking 1st group", function() {
-        expect(groups[0].get('status')).to.equal('COMPLETED');
-        expect(groups[0].get('progress_percent')).to.equal(100);
-        expect(groups[0].get('completed_task_count')).to.equal(3);
-        expect(groups[0].get('upgradeItems')[0].get('status')).to.equal('COMPLETED');
-        expect(groups[0].get('upgradeItems')[0].get('progress_percent')).to.equal(100);
-        expect(groups[0].get('hasExpandableItems')).to.be.true;
+      describe("checking 1st group", function() {
+        it('status is COMPLETED', function () {
+          expect(groups[0].get('status')).to.equal('COMPLETED');
+        });
+        it('progress_percent is 100', function () {
+          expect(groups[0].get('progress_percent')).to.equal(100);
+        });
+        it('completed_task_count = 3', function () {
+          expect(groups[0].get('completed_task_count')).to.equal(3);
+        });
+        it('upgradeItems.0.status is COMPLETED', function () {
+          expect(groups[0].get('upgradeItems')[0].get('status')).to.equal('COMPLETED');
+        });
+        it('upgradeItems.0.progress_percent is 100', function () {
+          expect(groups[0].get('upgradeItems')[0].get('progress_percent')).to.equal(100);
+        });
+        it('hasExpandableItems is true', function () {
+          expect(groups[0].get('hasExpandableItems')).to.be.true;
+        });
       });
 
-      it('checking 2nd group', function () {
-        expect(groups[1].get('status')).to.equal('ABORTED');
-        expect(groups[1].get('progress_percent')).to.equal(50);
-        expect(groups[1].get('completed_task_count')).to.equal(1);
-        expect(groups[1].get('upgradeItems').mapProperty('status')).to.eql(['ABORTED', 'PENDING']);
-        expect(groups[1].get('upgradeItems').mapProperty('progress_percent')).to.eql([99, 0]);
-        expect(groups[1].get('hasExpandableItems')).to.be.false;
+      describe('checking 2nd group', function () {
+        it('status is ABORTED', function () {
+          expect(groups[1].get('status')).to.equal('ABORTED');
+        });
+        it('progress_percent is 50', function () {
+          expect(groups[1].get('progress_percent')).to.equal(50);
+        });
+        it('completed_task_count = 1', function () {
+          expect(groups[1].get('completed_task_count')).to.equal(1);
+        });
+        it('upgradeItems.[].status = ["ABORTED", "PENDING"]', function () {
+          expect(groups[1].get('upgradeItems').mapProperty('status')).to.eql(['ABORTED', 'PENDING']);
+        });
+        it('upgradeItems.[].progress_percent = [99, 0]', function () {
+          expect(groups[1].get('upgradeItems').mapProperty('progress_percent')).to.eql([99, 0]);
+        });
+        it('hasExpandableItems is false', function () {
+          expect(groups[1].get('hasExpandableItems')).to.be.false;
+        });
       });
 
     });
@@ -802,14 +853,17 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#confirmDowngrade()", function() {
+
     before(function () {
       sinon.spy(App, 'showConfirmationPopup');
       sinon.stub(controller, 'downgrade', Em.K);
     });
+
     after(function () {
       App.showConfirmationPopup.restore();
       controller.downgrade.restore();
     });
+
     it("show confirmation popup", function() {
       controller.set('currentVersion', Em.Object.create({
         repository_version: '2.2',
@@ -826,8 +880,9 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#upgradeOptions()", function() {
-    before(function () {
-      sinon.spy(App, 'ModalPopup');
+    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) {
@@ -846,38 +901,77 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           status: 'CURRENT'
         })
       ]);
-    });
-    beforeEach(function () {
       controller.get('runningCheckRequests').clear();
     });
-    after(function () {
-      App.ModalPopup.restore();
+
+    afterEach(function () {
+      App.ModalPopup.show.restore();
       App.showConfirmationFeedBackPopup.restore();
       controller.runPreUpgradeCheck.restore();
       controller.getSupportedUpgradeTypes.restore();
       controller.get('upgradeMethods').setEach('selected', false);
       App.RepositoryVersion.find.restore();
     });
-    it("show confirmation popup", function() {
-      var version = Em.Object.create({displayName: 'HDP-2.2'});
-      controller.set('isDowngrade', false);
-      var popup = controller.upgradeOptions(false, version);
-      expect(App.ModalPopup.calledOnce).to.be.true;
-      expect(controller.get('upgradeMethods').everyProperty('isCheckRequestInProgress')).to.be.true;
-      expect(controller.get('upgradeMethods').someProperty('selected')).to.be.false;
-      controller.get('upgradeMethods')[0].set('selected', true);
-      var confirmPopup = popup.onPrimary();
-      expect(App.showConfirmationFeedBackPopup.calledOnce).to.be.true;
-      confirmPopup.onPrimary();
-      expect(controller.runPreUpgradeCheck.calledWith(version)).to.be.true;
-      expect( controller.get('runningCheckRequests')).to.have.length(1);
-    });
-    it("NOT show confirmation popup on Downgrade", function() {
-      var version = Em.Object.create({displayName: 'HDP-2.2'});
-      controller.set('isDowngrade', true);
-      controller.upgradeOptions(false, version);
-      expect(App.ModalPopup.calledOnce).to.be.false;
-      expect( controller.get('runningCheckRequests')).to.have.length(1);
+
+    describe("show confirmation popup", function() {
+
+      beforeEach(function () {
+        controller.set('isDowngrade', false);
+        this.popup = controller.upgradeOptions(false, version);
+      });
+
+      it('popup is shown', function () {
+        expect(App.ModalPopup.show.calledOnce).to.be.true;
+      });
+
+      it('all upgradeMethods have isCheckRequestInProgress = true', function () {
+        expect(controller.get('upgradeMethods').everyProperty('isCheckRequestInProgress')).to.be.true;
+      });
+
+      it('upgradeMethods no one is selected', function () {
+        expect(controller.get('upgradeMethods').someProperty('selected')).to.be.false;
+      });
+
+      describe('#popup.onPrimary', function () {
+
+        beforeEach(function () {
+          controller.get('upgradeMethods')[0].set('selected', true);
+          this.confirmPopup = this.popup.onPrimary();
+        });
+
+        it('showConfirmationFeedBackPopup is called once', function () {
+          expect(App.showConfirmationFeedBackPopup.calledOnce).to.be.true;
+        });
+
+        describe('#confirmPopup.onPrimary', function () {
+          beforeEach(function () {
+            this.confirmPopup.onPrimary();
+          });
+
+          it('runPreUpgradeCheck is called with correct version', function () {
+            expect(controller.runPreUpgradeCheck.calledWith(version)).to.be.true;
+          });
+
+          it('runningCheckRequests has 1 item', function () {
+            expect(controller.get('runningCheckRequests')).to.have.length(1);
+          });
+
+        });
+
+      });
+
+    });
+
+    describe("NOT show confirmation popup on Downgrade", function() {
+      beforeEach(function () {
+        controller.set('isDowngrade', true);
+        controller.upgradeOptions(false, version);
+      });
+
+      it('runningCheckRequests has 1 item', function () {
+        expect( controller.get('runningCheckRequests')).to.have.length(1);
+      });
+
     });
   });
 
@@ -896,7 +990,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#downgrade()", function() {
-    before(function () {
+    beforeEach(function () {
       sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(controller, 'abortUpgrade');
       sinon.stub(App.RepositoryVersion, 'find').returns([
@@ -905,20 +999,25 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           repositoryVersion: '2.3'
         })
       ]);
-    });
-    after(function () {
-      App.ajax.send.restore();
-      controller.abortUpgrade.restore();
-      App.RepositoryVersion.find.restore();
-    });
-    it("make ajax call", function() {
       controller.set('upgradeVersion', 'HDP-2.3');
       controller.set('upgradeType', 'NON_ROLLING');
       controller.downgrade(Em.Object.create({
         repository_version: '2.2',
         repository_name: 'HDP-2.2'
       }), {context: 'context'});
+      this.callArgs = App.ajax.send.getCall(0).args[0];
+    });
+
+    afterEach(function () {
+      App.ajax.send.restore();
+      controller.abortUpgrade.restore();
+      App.RepositoryVersion.find.restore();
+    });
+
+    it('abortUpgrade is called once', function() {
       expect(controller.abortUpgrade.calledOnce).to.be.true;
+    });
+    it('request-data is valid', function () {
       expect(App.ajax.send.getCall(0).args[0].data).to.eql({
         from: '2.3',
         value: '2.2',
@@ -926,11 +1025,18 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         isDowngrade: true,
         upgradeType: "NON_ROLLING"
       });
-      var callArgs = App.ajax.send.getCall(0).args[0];
-      expect(callArgs.name).to.eql('admin.downgrade.start');
-      expect(callArgs.sender).to.eql(controller);
-      expect(callArgs.success).to.eql('upgradeSuccessCallback');
-      expect(callArgs.callback).to.be.called;
+    });
+    it('request-name is valid', function () {
+      expect(this.callArgs.name).to.eql('admin.downgrade.start');
+    });
+    it('request-sender is valid', function () {
+      expect(this.callArgs.sender).to.eql(controller);
+    });
+    it('callback is valid', function () {
+      expect(this.callArgs.success).to.eql('upgradeSuccessCallback');
+    });
+    it('callback is called', function () {
+      expect(this.callArgs.callback).to.be.called;
     });
   });
 
@@ -1001,28 +1107,39 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#setUpgradeItemStatus()", function () {
-    before(function () {
+    var item;
+    beforeEach(function () {
       sinon.stub(App.ajax, 'send', function () {
         return {
           done: Em.clb
         }
       });
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
-    it("valid request is sent", function () {
-      var item = Em.Object.create({
+      item = Em.Object.create({
         request_id: 1,
         stage_id: 1,
         group_id: 1
       });
       controller.setUpgradeItemStatus(item, 'PENDING');
-      var callArgs = App.ajax.send.getCall(0).args[0];
-      expect(callArgs.data).to.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'});
-      expect(callArgs.name).to.eql('admin.upgrade.upgradeItem.setState');
-      expect(callArgs.sender).to.eql(controller);
-      expect(callArgs.callback).to.be.called;
+      this.callArgs = App.ajax.send.getCall(0).args[0];
+    });
+
+    afterEach(function () {
+      App.ajax.send.restore();
+    });
+
+    it('request-data is valid', function () {
+      expect(this.callArgs.data).to.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'});
+    });
+    it('request-name is valid', function () {
+      expect(this.callArgs.name).to.eql('admin.upgrade.upgradeItem.setState');
+    });
+    it('request-sendeer is valid', function () {
+      expect(this.callArgs.sender).to.eql(controller);
+    });
+    it('callback is called', function () {
+      expect(this.callArgs.callback).to.be.called;
+    });
+    it('item.status is PENDING', function () {
       expect(item.get('status')).to.equal('PENDING');
     });
   });
@@ -1238,17 +1355,24 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        sinon.stub(App.RepositoryVersion, 'find').returns([
-          Em.Object.create({
-            status: 'CURRENT',
-            stackVersionType: item.stackVersionType
-          })
-        ]);
-        controller.set('currentVersion', {
-          repository_version: item.repoVersion
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          sinon.stub(App.RepositoryVersion, 'find').returns([
+            Em.Object.create({
+              status: 'CURRENT',
+              stackVersionType: item.stackVersionType
+            })
+          ]);
+          controller.set('currentVersion', {
+            repository_version: item.repoVersion
+          });
         });
-        expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+
+        it('isStormMetricsSupported is ' + (item.isStormMetricsSupported ? '' : 'not') + ' supported', function () {
+          expect(App.get('isStormMetricsSupported')).to.equal(item.isStormMetricsSupported);
+        });
+
       });
     });
 
@@ -1259,25 +1383,42 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     beforeEach(function() {
       sinon.stub($, 'ajax', Em.K);
       controller.set('isFinalizeItem', true);
+      this.stub = sinon.stub(App, 'get');
     });
 
     afterEach(function () {
       $.ajax.restore();
+      this.stub.restore();
     });
 
-    it('should do ajax-request', function () {
-      sinon.stub(App, 'get').withArgs('upgradeState').returns('HOLDING');
-      controller.updateFinalize();
-      App.get.restore();
-      expect($.ajax.calledOnce).to.be.true;
+    describe('should do ajax-request', function () {
+
+      beforeEach(function () {
+        this.stub.withArgs('upgradeState').returns('HOLDING');
+        controller.updateFinalize();
+      });
+
+      it('request is sent', function () {
+        expect($.ajax.calledOnce).to.be.true;
+      });
+
     });
 
-    it('shouldn\'t do ajax-request', function () {
-      sinon.stub(App, 'get').withArgs('upgradeState').returns('HOLDING_TIMEDOUT');
-      controller.updateFinalize();
-      App.get.restore();
-      expect(controller.get('isFinalizeItem')).to.be.false;
-      expect($.ajax.calledOnce).to.be.false;
+    describe('shouldn\'t do ajax-request', function () {
+
+      beforeEach(function () {
+        this.stub.withArgs('upgradeState').returns('HOLDING_TIMEDOUT');
+        controller.updateFinalize();
+      });
+
+      it('request is not sent', function () {
+        expect($.ajax.called).to.be.false;
+      });
+
+      it('isFinalizeItem is false', function () {
+        expect(controller.get('isFinalizeItem')).to.be.false;
+      });
+
     });
 
   });
@@ -1900,19 +2041,38 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        var runningCheckRequests = controller.get('runningCheckRequests');
-        appGetMock.returns(item.supportsPreUpgradeCheck);
-        controller.runPreUpgradeCheckOnly({
-          type: item.type
+      describe(item.title, function () {
+        var runningCheckRequests;
+        beforeEach(function () {
+          runningCheckRequests = controller.get('runningCheckRequests');
+          appGetMock.returns(item.supportsPreUpgradeCheck);
+          controller.runPreUpgradeCheckOnly({
+            type: item.type
+          });
         });
-        expect(upgradeMethods.findProperty('type', 'ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.ru);
-        expect(upgradeMethods.findProperty('type', 'NON_ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.eu);
-        expect(App.ajax.send.callCount).to.equal(item.ajaxCallCount);
-        expect(runningCheckRequests).to.have.length(item.runningCheckRequestsLength);
+
+        it('ROLLING properties', function () {
+          expect(upgradeMethods.findProperty('type', 'ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.ru);
+        });
+
+        it('NON_ROLLING properties', function () {
+          expect(upgradeMethods.findProperty('type', 'NON_ROLLING').getProperties('isCheckComplete', 'isCheckRequestInProgress', 'action')).to.eql(item.eu);
+        });
+
+        it(item.ajaxCallCount + ' requests sent', function () {
+          expect(App.ajax.send.callCount).to.equal(item.ajaxCallCount);
+        });
+
+        it('runningCheckRequests length is ' + item.runningCheckRequestsLength, function () {
+          expect(runningCheckRequests).to.have.length(item.runningCheckRequestsLength);
+        });
+
         if (item.runningCheckRequestsLength) {
-          expect(runningCheckRequests[0].type).to.equal(item.type);
+          it('runningCheckRequests.type is ' + item.type, function () {
+            expect(runningCheckRequests[0].type).to.equal(item.type);
+          });
         }
+
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index 530c6ad..f39f7bf 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -474,8 +474,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
 
   describe('#changeType()', function () {
 
-    it('should disable and enable appropriate configs', function () {
-
+    beforeEach(function () {
       controller.set('allServices', ['service1', 'service2']);
       controller.set('allScopes', ['scope1', 'scope2']);
 
@@ -484,25 +483,57 @@ describe('App.MainAlertDefinitionConfigsController', function () {
         Em.Object.create({name: 'component', isDisabled: false}),
         Em.Object.create({name: 'scope', isDisabled: false})
       ]);
+    });
 
-      controller.changeType('Host Alert Definition');
+    describe('Host Alert Definition', function () {
 
-      expect(controller.get('configs').everyProperty('isDisabled', true)).to.be.true;
-      expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['Ambari']);
-      expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('Ambari');
-      expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('Ambari Agent');
-      expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['Host']);
-      expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('Host');
+      beforeEach(function () {
+        controller.changeType('Host Alert Definition');
+      });
 
-      controller.changeType('alert_type_service');
+      it('all configs are disabled', function () {
+        expect(controller.get('configs').everyProperty('isDisabled', true)).to.be.true;
+      });
+      it('service.options = ["Ambari"]', function () {
+        expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['Ambari']);
+      });
+      it('service.value = "Ambari"', function () {
+        expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('Ambari');
+      });
+      it('component.value = "Ambari Agent"', function () {
+        expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('Ambari Agent');
+      });
+      it('scope.options = ["Host"]', function () {
+        expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['Host']);
+      });
+      it('isDisabled.value = "Host"', function () {
+        expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('Host');
+      });
+    });
 
-      expect(controller.get('configs').everyProperty('isDisabled', false)).to.be.true;
-      expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['service1', 'service2']);
-      expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('service1');
-      expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('No component');
-      expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['scope1', 'scope2']);
-      expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('scope1');
+    describe('alert_type_service', function () {
 
+      beforeEach(function () {
+        controller.changeType('alert_type_service');
+      });
+      it('all configs are not disabled', function () {
+        expect(controller.get('configs').everyProperty('isDisabled', false)).to.be.true;
+      });
+      it('service.options = ["service1", "service2"]', function () {
+        expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['service1', 'service2']);
+      });
+      it('service.value = "service1"', function () {
+        expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('service1');
+      });
+      it('component.value = "No component"', function () {
+        expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('No component');
+      });
+      it('scope.options = ["scope1", "scope2"]', function () {
+        expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['scope1', 'scope2']);
+      });
+      it('scope.value = "scope1"', function () {
+        expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('scope1');
+      });
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a487e501/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
----------------------------------------------------------------------
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 25ed383..025ce86 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
@@ -585,20 +585,20 @@ describe('App.ManageAlertNotificationsController', function () {
           expect(view.get('parentView.hasErrors')).to.be.true;
         });
 
-        it('should check inputFields.name.value', function () {
+        it('should check inputFields.name.value (2)', function () {
           view.set('controller.inputFields.name.errorMsg', 'error');
           view.set('controller.inputFields.name.value', 'test');
           expect(view.get('controller.inputFields.name.errorMsg')).to.equal('');
         });
 
-        it('should check inputFields.name.value', function () {
+        it('should check inputFields.name.value (3)', function () {
           view.set('isEdit', true);
           view.set('controller.inputFields.name.value', '');
           expect(view.get('controller.inputFields.name.errorMsg')).to.equal(Em.I18n.t('alerts.actions.manage_alert_notifications_popup.error.name.empty'));
           expect(view.get('parentView.hasErrors')).to.be.true;
         });
 
-        it('should check inputFields.name.value', function () {
+        it('should check inputFields.name.value (4)', function () {
           view.set('isEdit', true);
           view.set('controller.inputFields.name.errorMsg', 'error');
           view.set('controller.inputFields.name.value', 'test');
@@ -620,7 +620,7 @@ describe('App.ManageAlertNotificationsController', function () {
 
         });
 
-        it('should check inputFields.retypeSMTPPassword.value', function () {
+        it('should check inputFields.retypeSMTPPassword.value (2)', function () {
 
           view.set('parentView.hasErrors', true);
           view.set('controller.inputFields.retypeSMTPPassword.errorMsg', 'error');
@@ -883,24 +883,33 @@ describe('App.ManageAlertNotificationsController', function () {
   });
 
   describe('#deleteAlertNotificationSuccessCallback()', function () {
+    var mockSelectedAlertNotification;
 
-    it("should call loadAlertNotifications, selectedAlertNotification.deleteRecord and set null to selectedAlertNotification", function () {
-
-      var mockSelectedAlertNotification = {
+    beforeEach(function () {
+      mockSelectedAlertNotification = {
         deleteRecord: Em.K
       };
       controller.set('selectedAlertNotification', mockSelectedAlertNotification);
       sinon.stub(controller, 'loadAlertNotifications', Em.K);
       sinon.spy(mockSelectedAlertNotification, 'deleteRecord');
-
       controller.deleteAlertNotificationSuccessCallback();
+    });
+
+    afterEach(function () {
+      controller.loadAlertNotifications.restore();
+      mockSelectedAlertNotification.deleteRecord.restore();
+    });
 
+    it("should call loadAlertNotifications", function () {
       expect(controller.loadAlertNotifications.calledOnce).to.be.true;
+    });
+
+    it("should call selectedAlertNotification.deleteRecord", function () {
       expect(mockSelectedAlertNotification.deleteRecord.calledOnce).to.be.true;
-      expect(controller.get('selectedAlertNotification')).to.equal(null);
+    });
 
-      controller.loadAlertNotifications.restore();
-      mockSelectedAlertNotification.deleteRecord.restore();
+    it("should set null to selectedAlertNotification", function () {
+      expect(controller.get('selectedAlertNotification')).to.equal(null);
     });
 
   });


Mime
View raw message