You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/12/25 15:28:14 UTC

[3/3] ambari git commit: AMBARI-14495. Improve Ambari UI UT (p.2) (onechiporenko)

AMBARI-14495. Improve Ambari UI UT (p.2) (onechiporenko)


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

Branch: refs/heads/trunk
Commit: f8213edb4fe67fb0c6f9b3c8f881430aeb188e2d
Parents: bc841dc
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Dec 25 13:34:34 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Dec 25 16:27:53 2015 +0200

----------------------------------------------------------------------
 .../test/controllers/wizard/step10_test.js      |  51 ++-
 .../test/controllers/wizard/step2_test.js       |  30 +-
 .../test/controllers/wizard/step3_test.js       | 300 ++++++-------
 .../test/controllers/wizard/step4_test.js       |  93 ++--
 .../test/controllers/wizard/step5_test.js       | 217 ++++++---
 .../test/controllers/wizard/step6_test.js       |  41 +-
 .../test/controllers/wizard/step7_test.js       | 355 +++++++++------
 .../test/controllers/wizard/step8_test.js       | 438 +++++++++++--------
 .../test/controllers/wizard/step9_test.js       |  89 ++--
 ambari-web/test/controllers/wizard_test.js      | 131 ++++--
 .../test/data/HDP2.2/site_properties_test.js    |  26 +-
 .../test/data/HDP2.3/site_properties_test.js    |  26 +-
 .../test/data/HDP2/site_properties_test.js      |  26 +-
 .../alert_definition_summary_mapper_test.js     | 165 +++++--
 .../service_config_version_mapper_test.js       |  83 +++-
 .../stack_config_properties_mapper_test.js      | 382 +++++++++-------
 .../test/mappers/configs/themes_mapper_test.js  | 180 ++++----
 ambari-web/test/mappers/service_mapper_test.js  |  15 +-
 ambari-web/test/mappers/stack_mapper_test.js    |  24 +-
 ambari-web/test/utils/blueprint_test.js         |  10 +-
 ambari-web/test/utils/helper_test.js            |   5 +-
 .../alerts/manage_alert_groups_view_test.js     |  59 ---
 .../views/main/service/info/summary_test.js     |  15 +-
 23 files changed, 1633 insertions(+), 1128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step10_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step10_test.js b/ambari-web/test/controllers/wizard/step10_test.js
index 8238e89..d6ce4b4 100644
--- a/ambari-web/test/controllers/wizard/step10_test.js
+++ b/ambari-web/test/controllers/wizard/step10_test.js
@@ -98,14 +98,24 @@ describe('App.WizardStep10Controller', function () {
       }
     ]);
     testsForLoadInstallTime.forEach(function(test) {
-      it('loadMasterComponents: ' + test.loadMasterComponents.toString() + ' loadStartedServices: ' + test.loadStartedServices.toString(), function() {
-        controller.set('content.controllerName', 'installerController');
-        sinon.stub(controller, 'loadMasterComponents', function() {return test.loadMasterComponents;});
-        sinon.stub(controller, 'loadStartedServices', function() {return test.loadStartedServices;});
-        controller.loadStep();
-        expect(controller.loadInstallTime.called).to.equal(test.e);
-        controller.loadMasterComponents.restore();
-        controller.loadStartedServices.restore();
+      describe('loadMasterComponents: ' + test.loadMasterComponents.toString() + ' loadStartedServices: ' + test.loadStartedServices.toString(), function() {
+
+        beforeEach(function () {
+          controller.set('content.controllerName', 'installerController');
+          sinon.stub(controller, 'loadMasterComponents', function() {return test.loadMasterComponents;});
+          sinon.stub(controller, 'loadStartedServices', function() {return test.loadStartedServices;});
+          controller.loadStep();
+        });
+
+        afterEach(function () {
+          controller.loadMasterComponents.restore();
+          controller.loadStartedServices.restore();
+        });
+
+        it('loadInstallTime was ' + (test.e ? '' : 'not') + ' called', function () {
+          expect(controller.loadInstallTime.called).to.equal(test.e);
+        });
+
       });
     });
   });
@@ -426,22 +436,37 @@ describe('App.WizardStep10Controller', function () {
   });
 
   describe('#loadRegisteredHosts', function() {
-    it('should add object to clusterInfo', function() {
-      var masterComponentHosts = [{hostName: 'h1'}, {hostName: 'h2'}, {hostName: 'h3'}],
-        slaveComponentHosts = [{hosts: [{hostName: 'h1'}, {hostName: 'h4'}]}, {hosts: [{hostName: 'h2'}, {hostName: 'h5'}]}],
-        hosts = [{hostName: 'h6'}, {hostName: 'h3'}, {hostName: 'h7'}];
+    var masterComponentHosts = [{hostName: 'h1'}, {hostName: 'h2'}, {hostName: 'h3'}],
+      slaveComponentHosts = [{hosts: [{hostName: 'h1'}, {hostName: 'h4'}]}, {hosts: [{hostName: 'h2'}, {hostName: 'h5'}]}],
+      hosts = [{hostName: 'h6'}, {hostName: 'h3'}, {hostName: 'h7'}];
+    var obj;
+    beforeEach(function () {
       controller.set('content.masterComponentHosts', masterComponentHosts);
       controller.set('content.slaveComponentHosts', slaveComponentHosts);
       controller.set('clusterInfo', []);
       sinon.stub(App.Host, 'find', function() {
         return hosts;
       });
-      var obj = controller.loadRegisteredHosts();
+      obj = controller.loadRegisteredHosts();
+    });
+
+    afterEach(function () {
       App.Host.find.restore();
+    });
+
+    it('id  = 1', function() {
       expect(obj.id).to.equal(1);
+    });
+    it('color = text-info', function () {
       expect(obj.color).to.equal('text-info');
+    });
+    it('displayStatement is valid', function () {
       expect(obj.displayStatement).to.equal(Em.I18n.t('installer.step10.hostsSummary').format(7));
+    });
+    it('status is []', function () {
       expect(obj.status).to.eql([]);
+    });
+    it('clusterInfo.firstObject is valid', function () {
       expect(controller.get('clusterInfo.firstObject')).to.eql(obj);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 8869444..843e4c2 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -270,13 +270,17 @@ describe('App.WizardStep2Controller', function () {
 
   describe('#agentUserError', function () {
 
+    beforeEach(function () {
+      this.stub = sinon.stub(App, 'get');
+    });
+
     afterEach(function () {
       App.get.restore();
     });
 
     userErrorTests.forEach(function(test) {
       it('Ambari Agent user account customize enabled', function() {
-        sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(true);
+        this.stub.withArgs('supports.customizeAgentUserAccount').returns(true);
         var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, agentUser: test.user}}});
         if(Em.isNone(test.e)) {
           expect(controller.get('agentUserError')).to.be.null;
@@ -289,7 +293,7 @@ describe('App.WizardStep2Controller', function () {
 
     userErrorTests.forEach(function(test) {
       it('Ambari Agent user account customize disabled', function() {
-        sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(false);
+        this.stub.withArgs('supports.customizeAgentUserAccount').returns(false);
         var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, agentUser: test.user}}});
         expect(controller.get('agentUserError')).to.be.null;
       });
@@ -428,14 +432,24 @@ describe('App.WizardStep2Controller', function () {
 
   describe('#proceedNext()', function () {
 
+    beforeEach(function () {
+      sinon.stub(c, 'warningPopup', Em.K);
+      sinon.stub(c, 'manualInstallPopup', Em.K);
+      sinon.stub(App.router, 'send', Em.K);
+    });
+
+    afterEach(function () {
+      c.warningPopup.restore();
+      c.manualInstallPopup.restore();
+      App.router.send.restore();
+    });
+
     it('should call warningPopup if not isAllHostNamesValid and no warningConfirmed', function() {
       c.reopen({
         isAllHostNamesValid: function() {
           return false;
-        },
-        warningPopup: Em.K
+        }
       });
-      sinon.spy(c, 'warningPopup');
       var r = c.proceedNext(false);
       expect(r).to.equal(false);
       expect(c.warningPopup.calledOnce).to.equal(true);
@@ -444,17 +458,14 @@ describe('App.WizardStep2Controller', function () {
     it('should call manualInstallPopup if manualInstall is true', function () {
       c.reopen({
         hostNames: '',
-        manualInstall: true,
-        manualInstallPopup: Em.K
+        manualInstall: true
       });
-      sinon.spy(c, 'manualInstallPopup');
       var r = c.proceedNext(true);
       expect(r).to.equal(false);
       expect(c.manualInstallPopup.calledOnce).to.equal(true);
     });
 
     it ('should save hosts and proceed next if manualInstall is false', function() {
-      sinon.stub(App.router, 'send', Em.K);
       c.reopen({
         hostNameArr: ['h1'],
         manualInstall: false,
@@ -468,7 +479,6 @@ describe('App.WizardStep2Controller', function () {
       expect(r).to.equal(true);
       expect(Em.keys(c.get('content.hosts'))).to.eql(['h1']);
       expect(App.router.send.calledWith('next')).to.equal(true);
-      App.router.send.restore();
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index 6262678..309d658 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -155,23 +155,15 @@ describe('App.WizardStep3Controller', function () {
 
   describe('#isWarningsBoxVisible', function () {
 
-    afterEach(function () {
-      App.get.restore();
+    beforeEach(function () {
+      sinon.stub(App, 'get').withArgs('testMode').returns(false);
     });
 
-    it('for testMode should be always true', function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return true;
-        return Em.get(App, k);
-      });
-      expect(c.get('isWarningsBoxVisible')).to.equal(true);
+    afterEach(function () {
+      App.get.restore();
     });
 
     it('for "real" mode should be based on isRegistrationInProgress', function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
       c.set('isRegistrationInProgress', false);
       expect(c.get('isWarningsBoxVisible')).to.equal(true);
       c.set('isRegistrationInProgress', true);
@@ -218,11 +210,6 @@ describe('App.WizardStep3Controller', function () {
       expect(c.get('isSubmitDisabled')).to.equal(true);
     });
 
-    it('should set isSubmitDisabled to true', function () {
-      c.set('isRetryDisabled', false);
-      c.clearStep();
-      expect(c.get('isRetryDisabled')).to.equal(true);
-    });
   });
 
   describe('#loadStep', function () {
@@ -306,7 +293,7 @@ describe('App.WizardStep3Controller', function () {
       expect(c.get('hosts').everyProperty('bootStatus', 'PENDING')).to.equal(true);
     });
 
-    it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected', function () {
+    it('should set bootStatus PENDING on "real" mode and when installOptions.manualInstall is not selected (2)', function () {
       App.set('testMode', true);
       c.set('content', {hosts: {c: {name: 'name'}, d: {name: 'name1'}}});
       c.loadHosts();
@@ -527,29 +514,39 @@ describe('App.WizardStep3Controller', function () {
     });
 
     agentUserCases.forEach(function (item) {
-      it(item.title, function () {
-        var controller = App.WizardStep3Controller.create({
-          content: {
-            installOptions: {
-              sshKey: 'key',
-              sshUser: 'root',
-              sshPort: '123',
-              agentUser: 'user'
-            },
-            hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } }
-          }
+      describe(item.title, function () {
+        var controller;
+        beforeEach(function () {
+          controller = App.WizardStep3Controller.create({
+            content: {
+              installOptions: {
+                sshKey: 'key',
+                sshUser: 'root',
+                sshPort: '123',
+                agentUser: 'user'
+              },
+              hosts: { "host0": { "name": "host0" }, "host1": { "name": "host1" } }
+            }
+          });
+          sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
+          controller.setupBootStrap();
         });
-        sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount);
-        controller.setupBootStrap();
-        App.get.restore();
-        expect(installer.launchBootstrap.firstCall.args[0]).to.equal(JSON.stringify({
-          verbose: true,
-          sshKey: 'key',
-          hosts: ['host0', 'host1'],
-          user: 'root',
-          sshPort: '123',
-          userRunAs: item.userRunAs
-        }));
+
+        afterEach(function () {
+          App.get.restore();
+        });
+
+        it('launchBootstrap is called with correct arguments', function () {
+          expect(installer.launchBootstrap.firstCall.args[0]).to.equal(JSON.stringify({
+            verbose: true,
+            sshKey: 'key',
+            hosts: ['host0', 'host1'],
+            user: 'root',
+            sshPort: '123',
+            userRunAs: item.userRunAs
+          }));
+        });
+
       });
     });
   });
@@ -631,7 +628,7 @@ describe('App.WizardStep3Controller', function () {
       expect(c.get('registrationStartedAt')).to.be.null;
     });
 
-    it('should drop numPolls and registrationStartedAt', function () {
+    it('should drop numPolls and registrationStartedAt (2)', function () {
       c.set('hosts', Em.A([
         {name: 'c1'},
         {name: 'c2'}
@@ -770,7 +767,7 @@ describe('App.WizardStep3Controller', function () {
       expect(c.get('registrationStartedAt')).to.equal(1234);
     });
 
-    it('shouldn\'t do nothing if registrationStartedAt isn\'t null', function () {
+    it('shouldn\'t do nothing if registrationStartedAt isn\'t null (2)', function () {
       c.set('registrationStartedAt', null);
       c.startRegistration();
       expect(c.isHostsRegistered.calledOnce).to.equal(true);
@@ -2276,62 +2273,50 @@ describe('App.WizardStep3Controller', function () {
         });
       });
 
-    it('should set test data if testMode is true', function () {
-      c.reopen({
-        isLoaded: true,
-        hosts: [
-          {},
-          {},
-          {}
-        ],
-        content: {
-          installedHosts: [],
-          installOptions: {
-            manualInstall: true
-          }
-        },
-        setRegistrationInProgress: Em.K
+    describe('should start registration', function () {
+
+      beforeEach(function () {
+        c.reopen({
+          isLoaded: true,
+          hosts: [
+            {},
+            {},
+            {}
+          ],
+          content: {
+            installedHosts: [],
+            installOptions: {
+              manualInstall: true
+            }
+          },
+          setRegistrationInProgress: Em.K,
+          startRegistration: Em.K
+        });
+        sinon.stub(App, 'get', function (k) {
+          if ('testMode' === k) return false;
+          return Em.get(App, k);
+        });
+        sinon.spy(c, 'startRegistration');
+        c.navigateStep();
       });
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return true;
-        return Em.get(App, k);
+
+
+      afterEach(function () {
+        App.get.restore();
+        c.startRegistration.restore();
       });
-      c.navigateStep();
-      App.get.restore();
-      expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
-      expect(c.get('bootHosts').everyProperty('cpu', '2')).to.equal(true);
-      expect(c.get('bootHosts').everyProperty('memory', '2000000')).to.equal(true);
-      expect(c.get('isSubmitDisabled')).to.equal(false);
-    });
 
-    it('should start registration', function () {
-      c.reopen({
-        isLoaded: true,
-        hosts: [
-          {},
-          {},
-          {}
-        ],
-        content: {
-          installedHosts: [],
-          installOptions: {
-            manualInstall: true
-          }
-        },
-        setRegistrationInProgress: Em.K,
-        startRegistration: Em.K
+      it('startRegistration is called once', function () {
+        expect(c.startRegistration.calledOnce).to.equal(true);
       });
-      sinon.stub(App, 'get', function (k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
+
+      it('all hosts are bootHosts', function () {
+        expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
+      });
+
+      it('registrationStartedAt is null', function () {
+        expect(c.get('registrationStartedAt')).to.be.null;
       });
-      sinon.spy(c, 'startRegistration');
-      c.navigateStep();
-      App.get.restore();
-      expect(c.startRegistration.calledOnce).to.equal(true);
-      c.startRegistration.restore();
-      expect(c.get('bootHosts.length')).to.equal(c.get('hosts.length'));
-      expect(c.get('registrationStartedAt')).to.be.null;
     });
 
   });
@@ -2506,12 +2491,29 @@ describe('App.WizardStep3Controller', function () {
 
   describe('#getHostInfoSuccessCallback', function () {
 
+    var jsonData = {items: [
+      {Hosts: {host_name: 'h1'}}
+    ]};
+
+    var skipBootstrap = false;
+
     beforeEach(function () {
       sinon.stub(c, 'parseWarnings', Em.K);
       sinon.stub(c, 'stopRegistration', Em.K);
       sinon.stub(c, 'checkHostDiskSpace', Em.K);
       sinon.stub(c, '_setHostDataFromLoadedHostInfo', Em.K);
       sinon.spy(c, '_setHostDataWithSkipBootstrap');
+      sinon.stub(App, 'get', function (k) {
+        if ('skipBootstrap' === k) return skipBootstrap;
+        if ('testMode' === k) return false;
+        return Em.get(App, k);
+      });
+      c.reopen({
+        bootHosts: [Em.Object.create({name: 'h1'})]
+      });
+      sinon.stub(c, 'checkHostOSType', function () {
+        return 'not_null_value';
+      });
     });
 
     afterEach(function () {
@@ -2520,73 +2522,28 @@ describe('App.WizardStep3Controller', function () {
       c.checkHostDiskSpace.restore();
       c._setHostDataFromLoadedHostInfo.restore();
       c._setHostDataWithSkipBootstrap.restore();
+      App.get.restore();
+      c.checkHostOSType.restore();
     });
 
     it('should call _setHostDataWithSkipBootstrap if skipBootstrap is true', function () {
-      sinon.stub(App, 'get', function (k) {
-        if ('skipBootstrap' === k) return true;
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
-      c.reopen({
-        bootHosts: [Em.Object.create({name: 'h1'})]
-      });
-      var jsonData = {items: [
-        {Hosts: {host_name: 'h1'}}
-      ]};
-      c.getHostInfoSuccessCallback(jsonData);
-      expect(c._setHostDataWithSkipBootstrap.calledOnce).to.equal(true);
-      App.get.restore();
+        skipBootstrap = true;
+        c.getHostInfoSuccessCallback(jsonData);
+        expect(c._setHostDataWithSkipBootstrap.calledOnce).to.equal(true);
     });
 
     it('should add repo warnings', function () {
-
-      var jsonData = {items: [
-        {Hosts: {host_name: 'h1'}}
-      ]};
-
-      sinon.stub(c, 'checkHostOSType', function () {
-        return 'not_null_value';
-      });
-      sinon.stub(App, 'get', function (k) {
-        if ('skipBootstrap' === k) return false;
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
-
-      c.reopen({
-        bootHosts: [Em.Object.create({name: 'h1'})]
-      });
-
+      skipBootstrap = false;
       c.getHostInfoSuccessCallback(jsonData);
       expect(c.get('repoCategoryWarnings.length')).to.equal(1);
       expect(c.get('repoCategoryWarnings.firstObject.hostsNames').contains('h1')).to.equal(true);
-
-      c.checkHostOSType.restore();
-      App.get.restore();
     });
 
     it('should add disk warnings', function () {
-
-      var jsonData = {items: [
-        {Hosts: {host_name: 'h1'}}
-      ]};
-
-      sinon.stub(App, 'get', function (k) {
-        if ('skipBootstrap' === k) return false;
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
-
-      c.reopen({
-        bootHosts: [Em.Object.create({name: 'h1'})]
-      });
-
+      skipBootstrap = false;
       c.getHostInfoSuccessCallback(jsonData);
       expect(c.get('diskCategoryWarnings.length')).to.equal(1);
       expect(c.get('diskCategoryWarnings.firstObject.hostsNames').contains('h1')).to.equal(true);
-
-      App.get.restore();
     });
 
   });
@@ -2604,32 +2561,47 @@ describe('App.WizardStep3Controller', function () {
   });
 
   describe('#_setHostDataFromLoadedHostInfo', function () {
-
-    it('should set data from hostInfo', function () {
-      var host = Em.Object.create(),
-        hostInfo = {
-          Hosts: {
-            cpu_count: 2,
-            total_mem: 12345,
-            os_type: 't1',
-            os_arch: 'os1',
-            os_family: 'osf1',
-            ip: '0.0.0.0',
-            disk_info: [
-              {mountpoint: '/boot'},
-              {mountpoint: '/usr'},
-              {mountpoint: '/no-boot'},
-              {mountpoint: '/boot'}
-            ]
-          }
-        };
+    var host;
+    beforeEach(function () {
+      host = Em.Object.create();
+      var hostInfo = {
+        Hosts: {
+          cpu_count: 2,
+          total_mem: 12345,
+          os_type: 't1',
+          os_arch: 'os1',
+          os_family: 'osf1',
+          ip: '0.0.0.0',
+          disk_info: [
+            {mountpoint: '/boot'},
+            {mountpoint: '/usr'},
+            {mountpoint: '/no-boot'},
+            {mountpoint: '/boot'}
+          ]
+        }
+      };
       c._setHostDataFromLoadedHostInfo(host, hostInfo);
+    });
+
+    it('cpu', function () {
       expect(host.get('cpu')).to.equal(2);
+    });
+    it('os_type', function () {
       expect(host.get('os_type')).to.equal('t1');
+    });
+    it('os_arch', function () {
       expect(host.get('os_arch')).to.equal('os1');
+    });
+    it('os_family', function () {
       expect(host.get('os_family')).to.equal('osf1');
+    });
+    it('ip', function () {
       expect(host.get('ip')).to.equal('0.0.0.0');
+    });
+    it('memory', function () {
       expect(host.get('memory')).to.equal('12345.00');
+    });
+    it('disk_info.length', function () {
       expect(host.get('disk_info.length')).to.equal(2);
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 8159498..69cc727 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -350,14 +350,23 @@ describe('App.WizardStep4Controller', function () {
     });
 
     sparkCases.forEach(function (item) {
-      it(item.title, function () {
-        sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
-          withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
-        controller.set('errorStack', []);
-        controller.set('content', generateSelectedServicesContent(['SPARK']));
-        controller.validate();
-        expect(controller.get('errorStack').someProperty('id', 'sparkWarning')).to.equal(item.sparkWarningExpected);
-        App.get.restore();
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
+            withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
+          controller.set('errorStack', []);
+          controller.set('content', generateSelectedServicesContent(['SPARK']));
+          controller.validate();
+        });
+
+        afterEach(function () {
+          App.get.restore();
+        });
+
+        it('sparkWarning ' + (item.sparkWarningExpected ? 'exists' : 'not exists'), function () {
+          expect(controller.get('errorStack').someProperty('id', 'sparkWarning')).to.equal(item.sparkWarningExpected);
+        });
       });
     });
 
@@ -406,37 +415,43 @@ describe('App.WizardStep4Controller', function () {
       var message = 'Selected services: {0}. {1} errors should be confirmed'
         .format(test.services.join(', '), test.confirmPopupCount);
 
-      it(message, function() {
+      describe(message, function() {
         var runValidations = function() {
           c.serviceDependencyValidation();
           c.fileSystemServiceValidation();
         };
 
-        c.set('content', generateSelectedServicesContent(test.services));
-        runValidations();
-        // errors count validation
-        expect(c.get('errorStack.length')).to.equal(test.confirmPopupCount);
-        // if errors detected than it should be shown
+        beforeEach(function () {
+          c.set('content', generateSelectedServicesContent(test.services));
+          runValidations();
+        });
+
+        it('errors count validation', function () {
+          expect(c.get('errorStack.length')).to.equal(test.confirmPopupCount);
+        });
+
         if (test.errorsExpected) {
-          test.errorsExpected.forEach(function(error, index, errors) {
-            // validate current error
-            var currentErrorObject = c.get('errorStack').findProperty('isShown', false);
-            if (currentErrorObject) {
-              expect(test.errorsExpected).to.contain(currentErrorObject.id);
-              // show current error
-              var popup = c.showError(currentErrorObject);
-              // submit popup
-              popup.onPrimary();
-              // onPrimaryPopupCallback should be called
-              expect(c.onPrimaryPopupCallback.called).to.equal(true);
-              // submit called
-              expect(c.submit.called).to.equal(true);
-              if (c.get('errorStack').length) {
-                // current error isShown flag changed to true
-                expect(currentErrorObject.isShown).to.equal(true);
+          it('if errors detected than it should be shown', function () {
+            test.errorsExpected.forEach(function(error, index, errors) {
+              // validate current error
+              var currentErrorObject = c.get('errorStack').findProperty('isShown', false);
+              if (currentErrorObject) {
+                expect(test.errorsExpected).to.contain(currentErrorObject.id);
+                // show current error
+                var popup = c.showError(currentErrorObject);
+                // submit popup
+                popup.onPrimary();
+                // onPrimaryPopupCallback should be called
+                expect(c.onPrimaryPopupCallback.called).to.equal(true);
+                // submit called
+                expect(c.submit.called).to.equal(true);
+                if (c.get('errorStack').length) {
+                  // current error isShown flag changed to true
+                  expect(currentErrorObject.isShown).to.equal(true);
+                }
+                runValidations();
               }
-              runValidations();
-            }
+            });
           });
         }
       });
@@ -445,6 +460,15 @@ describe('App.WizardStep4Controller', function () {
   });
 
   describe('#needToAddServicePopup', function() {
+
+    beforeEach(function () {
+      sinon.stub(controller, 'submit', Em.K);
+    });
+
+    afterEach(function () {
+      controller.submit.restore();
+    });
+
     Em.A([
         {
           m: 'one service',
@@ -461,12 +485,10 @@ describe('App.WizardStep4Controller', function () {
         }
       ]).forEach(function (test) {
         it(test.m, function () {
-          sinon.stub(controller, 'submit', Em.K);
           controller.set('content', test.content);
           controller.needToAddServicePopup(test.services, '').onPrimary();
           expect(controller.submit.calledOnce).to.equal(true);
           expect(controller.mapProperty('isSelected')).to.eql(test.e);
-          controller.submit.restore();
         });
       });
   });
@@ -765,6 +787,7 @@ describe('App.WizardStep4Controller', function () {
     beforeEach(function() {
       controller.clear();
       controller.set('errorStack', []);
+      this.stub = sinon.stub(App, 'get');
     });
 
     afterEach(function () {
@@ -773,7 +796,7 @@ describe('App.WizardStep4Controller', function () {
 
     cases.forEach(function (item) {
       it(item.title, function () {
-        sinon.stub(App, 'get').withArgs('currentStackName').returns(item.currentStackName).
+        this.stub.withArgs('currentStackName').returns(item.currentStackName).
           withArgs('currentStackVersionNumber').returns(item.currentStackVersionNumber);
         controller.set('content', generateSelectedServicesContent(item.services));
         var spark = controller.findProperty('serviceName', 'SPARK');

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 6f2e0e1..09da19e 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -293,21 +293,30 @@ describe('App.WizardStep5Controller', function () {
     ]);
 
     tests.forEach(function (test) {
-      it(test.m, function () {
-        sinon.stub(App.StackServiceComponent, 'find', function () {
-          return test.serviceComponents;
+      describe(test.m, function () {
+
+        beforeEach(function () {
+          sinon.stub(App.StackServiceComponent, 'find', function () {
+            return test.serviceComponents;
+          });
+          c.reopen({
+            content: Em.Object.create({
+              controllerName: test.controllerName
+            }),
+            selectedServicesMasters: test.selectedServicesMasters,
+            hosts: test.hosts
+          });
+          c.updateComponent(test.componentName);
         });
-        c.reopen({
-          content: Em.Object.create({
-            controllerName: test.controllerName
-          }),
-          selectedServicesMasters: test.selectedServicesMasters,
-          hosts: test.hosts
+
+        afterEach(function () {
+          App.StackServiceComponent.find.restore();
         });
-        c.updateComponent(test.componentName);
-        App.StackServiceComponent.find.restore();
+
         Em.keys(test.e).forEach(function (k) {
-          expect(c.last(test.componentName).get(k)).to.equal(test.e[k]);
+          it(k, function () {
+            expect(c.last(test.componentName).get(k)).to.equal(test.e[k]);
+          });
         });
 
       });
@@ -372,32 +381,52 @@ describe('App.WizardStep5Controller', function () {
       }
     ]);
     tests.forEach(function (test) {
-      beforeEach(function () {
-        App.reopen({isHaEnabled: test.isHaEnabled});
-      });
-      it(test.m, function () {
-        modelSetup.setupStackServiceComponent();
-        sinon.stub(App.StackService, 'find', function () {
-          return test.services;
+      describe(test.m, function () {
+
+        beforeEach(function () {
+          sinon.stub(App, 'get').withArgs('isHaEnabled').returns(test.isHaEnabled);
+          sinon.stub(App.StackService, 'find', function () {
+            return test.services;
+          });
+          modelSetup.setupStackServiceComponent();
+          c.reopen({
+            content: Em.Object.create({
+              services: test.services,
+              controllerName: test.controllerName,
+              reassign: {component_name: test.component_name}
+            })
+          });
+          c.renderComponents(test.masterComponents);
         });
-        App.set('isHaEnabled', test.isHaEnabled);
-        c.reopen({
-          content: Em.Object.create({
-            services: test.services,
-            controllerName: test.controllerName,
-            reassign: {component_name: test.component_name}
-          })
+
+        afterEach(function () {
+          App.get.restore();
+          App.StackService.find.restore();
+          modelSetup.cleanStackServiceComponent();
         });
-        c.renderComponents(test.masterComponents);
-        App.StackService.find.restore();
-        modelSetup.cleanStackServiceComponent();
-        expect(c.get('selectedServicesMasters').mapProperty('component_name')).to.eql(test.e.selectedServicesMasters);
-        expect(c.get('servicesMasters').mapProperty('component_name')).to.eql(test.e.servicesMasters);
-        expect(c.get('selectedServicesMasters').mapProperty('showRemoveControl')).to.eql(test.e.showRemoveControl);
-        expect(c.get('selectedServicesMasters').mapProperty('serviceComponentId')).to.eql(test.e.serviceComponentId);
-        if (c.get('isReasignController')) {
-          expect(c.get('servicesMasters').mapProperty('isInstalled')).to.eql(test.e.isInstalled);
-        }
+
+        it('all selectedServicesMasters.component_name are valid', function () {
+          expect(c.get('selectedServicesMasters').mapProperty('component_name')).to.eql(test.e.selectedServicesMasters);
+        });
+
+        it('all servicesMasters.component_name are valid', function () {
+          expect(c.get('servicesMasters').mapProperty('component_name')).to.eql(test.e.servicesMasters);
+        });
+
+        it('all showRemoveControl are valid', function () {
+          expect(c.get('selectedServicesMasters').mapProperty('showRemoveControl')).to.eql(test.e.showRemoveControl);
+        });
+
+        it('all serviceComponentId are valid', function () {
+          expect(c.get('selectedServicesMasters').mapProperty('serviceComponentId')).to.eql(test.e.serviceComponentId);
+        });
+
+        it('servicesMasters.@each.isInstalled is valid', function () {
+          if (c.get('isReasignController')) {
+            expect(c.get('servicesMasters').mapProperty('isInstalled')).to.eql(test.e.isInstalled);
+          }
+        });
+
       });
     });
   });
@@ -528,15 +557,34 @@ describe('App.WizardStep5Controller', function () {
       }
     ]);
     tests.forEach(function (test) {
-      it(test.m, function () {
-        c.set('selectedServicesMasters', test.selectedServicesMasters);
-        c.set('hosts', test.hosts);
-        expect(c.removeComponent(test.componentName, test.serviceComponentId)).to.equal(test.e);
+      describe(test.m, function () {
+
+        beforeEach(function () {
+          c.set('selectedServicesMasters', JSON.parse(JSON.stringify(test.selectedServicesMasters)));
+          c.set('hosts', test.hosts);
+          this.result = c.removeComponent(test.componentName, test.serviceComponentId);
+        });
+
+        it('removeComponent returns ' + test.e, function () {
+          expect(this.result).to.equal(test.e);
+        });
+
         if (test.e) {
-          expect(c.get('selectedServicesMasters.lastObject.showRemoveControl')).to.equal(test.showRemoveControl);
-          expect(c.get('selectedServicesMasters.lastObject.showAddControl')).to.equal(test.showAddControl);
-          expect(c.get('componentToRebalance')).to.equal(test.componentName);
-          expect(c.get('lastChangedComponent')).to.equal(test.componentName);
+          it('showRemoveControl is correct', function () {
+            expect(c.get('selectedServicesMasters.lastObject.showRemoveControl')).to.equal(test.showRemoveControl);
+          });
+
+          it('showAddControl is correct', function () {
+            expect(c.get('selectedServicesMasters.lastObject.showAddControl')).to.equal(test.showAddControl);
+          });
+
+          it('componentToRebalance is correct', function () {
+            expect(c.get('componentToRebalance')).to.equal(test.componentName);
+          });
+
+          it('lastChangedComponent is correct', function () {
+            expect(c.get('lastChangedComponent')).to.equal(test.componentName);
+          });
         }
       })
     });
@@ -641,17 +689,26 @@ describe('App.WizardStep5Controller', function () {
           ]
         }
       ]).forEach(function (test) {
-        it(test.m, function () {
-          c.reopen({
-            selectedServicesMasters: test.selectedServicesMasters,
-            hosts: test.hosts
+        describe(test.m, function () {
+          var result;
+          beforeEach(function () {
+            c.reopen({
+              selectedServicesMasters: test.selectedServicesMasters,
+              hosts: test.hosts
+            });
+            result = c.get('masterHostMapping');
           });
-          var result = c.get('masterHostMapping');
-          expect(result.length).to.equal(test.e.length);
-          result.forEach(function (r, i) {
-            expect(r.get('host_name')).to.equal(test.e[i].host_name);
-            expect(r.get('masterServices.length')).to.equal(test.e[i].masterServices.length);
-            expect(r.get('hostInfo')).to.be.an.object;
+
+          it('all needed hosts are mapped', function () {
+            expect(result.length).to.equal(test.e.length);
+          });
+
+          it('all needed hosts have valid data', function () {
+            result.forEach(function (r, i) {
+              expect(r.get('host_name')).to.equal(test.e[i].host_name);
+              expect(r.get('masterServices.length')).to.equal(test.e[i].masterServices.length);
+              expect(r.get('hostInfo')).to.be.an.object;
+            });
           });
         });
       });
@@ -959,13 +1016,20 @@ describe('App.WizardStep5Controller', function () {
           }
         }
       ]).forEach(function (test, i) {
-        it('test #' + i, function () {
-          sinon.stub(App.StackServiceComponent, 'find', function () {
-            return test.stackServiceComponents;
+        describe('test #' + i, function () {
+
+          beforeEach(function () {
+            sinon.stub(App.StackServiceComponent, 'find', function () {
+              return test.stackServiceComponents;
+            });
+            c.set('mastersToMove', test.mastersToMove);
+            c.set('content', {controllerName: test.controllerName});
           });
-          c.set('mastersToMove', test.mastersToMove);
-          c.set('content', {controllerName: test.controllerName});
-          expect(c.createComponentInstallationObject(test.fullComponent, test.hostName, test.savedComponent)).to.eql(test.e);
+
+          it('component-object is valid', function () {
+            expect(c.createComponentInstallationObject(test.fullComponent, test.hostName, test.savedComponent)).to.eql(test.e);
+          });
+
         });
       });
 
@@ -1122,7 +1186,7 @@ describe('App.WizardStep5Controller', function () {
       App.HostComponent.find.restore();
     });
 
-    it('should map messages to generalErrorMessages, generalWarningMessages', function() {
+    describe('should map messages to generalErrorMessages, generalWarningMessages', function() {
 
       var data = [
           {
@@ -1159,14 +1223,31 @@ describe('App.WizardStep5Controller', function () {
           Em.Object.create({selectedHost: 'h2', component_name: 'c2'})
         ];
 
-      c.set('servicesMasters', servicesMasters);
-      c.updateValidationsSuccessCallback({resources: [{items: data}]});
+      beforeEach(function () {
+        c.set('servicesMasters', servicesMasters);
+        c.updateValidationsSuccessCallback({resources: [{items: data}]});
+      });
+
+      it('submitDisabled is false', function () {
+        expect(c.get('submitDisabled')).to.equal(false);
+      });
+
+      it('errorMessage for c1 is `m1`', function () {
+        expect(c.get('servicesMasters').findProperty('component_name', 'c1').get('errorMessage')).to.equal('m1');
+      });
+
+      it('errorMessage for c2 is `m2`', function () {
+        expect(c.get('servicesMasters').findProperty('component_name', 'c2').get('warnMessage')).to.equal('m2');
+      });
+
+      it('no general errors', function () {
+        expect(c.get('generalErrorMessages')).to.be.empty;
+      });
+
+      it('no general warnings', function () {
+        expect(c.get('generalWarningMessages')).to.be.empty;
+      });
 
-      expect(c.get('submitDisabled')).to.equal(false);
-      expect(c.get('servicesMasters').findProperty('component_name', 'c1').get('errorMessage')).to.equal('m1');
-      expect(c.get('servicesMasters').findProperty('component_name', 'c2').get('warnMessage')).to.equal('m2');
-      expect(c.get('generalErrorMessages')).to.be.empty;
-      expect(c.get('generalWarningMessages')).to.be.empty;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 24c3153..1654958 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -671,7 +671,7 @@ describe('App.WizardStep6Controller', function () {
   });
 
   describe('#clearError', function () {
-    it('true if is one of checkboxes checked false', function () {
+    it('both checkboxes are checked', function () {
       var hosts = Em.A([
         Em.Object.create({
           checkboxes: Em.A([
@@ -696,6 +696,7 @@ describe('App.WizardStep6Controller', function () {
       controller.clearError();
       expect(controller.get('errorMessage')).to.equal('');
     });
+
     it('true if is one of checkboxes checked false', function () {
       var hosts = Em.A([
         Em.Object.create({
@@ -1553,20 +1554,36 @@ describe('App.WizardStep6Controller', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.controllerName, function () {
-        controller.set('hosts', item.hosts);
-        controller.set('content.controllerName', item.controllerName);
-        controller.callServerSideValidation();
-        expect(controller.get('content.recommendationsHostGroups.blueprint.host_groups.length')).to.equal(expectedHostGroups.length);
-        expect(controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups.length')).to.equal(expectedHostGroups.length);
-        controller.get('content.recommendationsHostGroups.blueprint.host_groups').forEach(function (group, index) {
-          expect(group.components.mapProperty('name').sort()).to.eql(item.expected[index]);
+      describe(item.controllerName, function () {
+
+        beforeEach(function () {
+          controller.set('hosts', item.hosts);
+          controller.set('content.controllerName', item.controllerName);
+          controller.callServerSideValidation();
         });
+
+        it('blueprint.host_groups count is correct', function () {
+          expect(controller.get('content.recommendationsHostGroups.blueprint.host_groups.length')).to.equal(expectedHostGroups.length);
+        });
+
+        it('blueprint_cluster_binding.host_groups count is correct', function () {
+          expect(controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups.length')).to.equal(expectedHostGroups.length);
+        });
+
+        it('components are valid for each group', function () {
+          controller.get('content.recommendationsHostGroups.blueprint.host_groups').forEach(function (group, index) {
+            expect(group.components.mapProperty('name').sort()).to.eql(item.expected[index]);
+          });
+        });
+
         expectedHostGroups.forEach(function (group) {
-          var bpGroup = controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups').findProperty('name', group.name);
-          expect(bpGroup.hosts).to.have.length(1);
-          expect(bpGroup.hosts[0].fqdn).to.equal(group.fqdn);
+          it(group.name, function () {
+            var bpGroup = controller.get('content.recommendationsHostGroups.blueprint_cluster_binding.host_groups').findProperty('name', group.name);
+            expect(bpGroup.hosts).to.have.length(1);
+            expect(bpGroup.hosts[0].fqdn).to.equal(group.fqdn);
+          });
         });
+
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 19c0196..3c23c54 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -674,6 +674,7 @@ describe('App.InstallerStep7Controller', function () {
   });
 
   describe('#_setOverrides', function () {
+
     it('shouldn\'t update config if no selectedConfigGroup', function () {
       installerStep7Controller.reopen({
         selectedConfigGroup: null
@@ -682,6 +683,7 @@ describe('App.InstallerStep7Controller', function () {
       var updatedConfig = installerStep7Controller._setOverrides(config, []);
       expect(updatedConfig.get('overrides')).to.be.null;
     });
+
     it('no overrideToAdd', function () {
       var isDefault = true,
         name = 'n1',
@@ -702,6 +704,7 @@ describe('App.InstallerStep7Controller', function () {
       expect(updatedConfig.get('overrides').everyProperty('isEditable', !isDefault)).to.equal(true);
       expect(updatedConfig.get('overrides').everyProperty('parentSCP.flag', 'flag')).to.equal(true);
     });
+
     it('overrideToAdd exists', function () {
       var isDefault = true,
         name = 'n1',
@@ -727,6 +730,7 @@ describe('App.InstallerStep7Controller', function () {
   });
 
   describe('#switchConfigGroupConfigs', function () {
+
     it('if selectedConfigGroup is null, serviceConfigs shouldn\'t be changed', function () {
       installerStep7Controller.reopen({
         selectedConfigGroup: null,
@@ -739,7 +743,9 @@ describe('App.InstallerStep7Controller', function () {
       installerStep7Controller.switchConfigGroupConfigs();
       expect(installerStep7Controller.get('serviceConfigs.configs').everyProperty('overrides.length', 0)).to.equal(true);
     });
-    it('should set configs for serviceConfigs', function () {
+
+    describe('should set configs for serviceConfigs', function () {
+
       var configGroups = [
         Em.Object.create({
           properties: [
@@ -748,27 +754,44 @@ describe('App.InstallerStep7Controller', function () {
           ]
         })
       ];
-      sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
-        return configGroups;
+
+      beforeEach(function () {
+        sinon.stub(installerStep7Controller, '_getDisplayedConfigGroups', function () {
+          return configGroups;
+        });
+        sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
+          config.set('isEditable', true);
+          return config;
+        });
+        installerStep7Controller.reopen({
+          selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
+          content: {services: []},
+          selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
+          serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
+        });
+        installerStep7Controller.switchConfigGroupConfigs();
+        this.configs = installerStep7Controller.get('selectedService.configs');
       });
-      sinon.stub(installerStep7Controller, '_setEditableValue', function (config) {
-        config.set('isEditable', true);
-        return config;
+
+      afterEach(function () {
+        installerStep7Controller._getDisplayedConfigGroups.restore();
+        installerStep7Controller._setEditableValue.restore();
       });
-      installerStep7Controller.reopen({
-        selectedConfigGroup: Em.Object.create({isDefault: true, name: 'g1'}),
-        content: {services: []},
-        selectedService: {configs: Em.A([Em.Object.create({name: 'g1', overrides: [], properties: []}), Em.Object.create({name: 'g2', overrides: []})])},
-        serviceConfigs: {configs: [Em.Object.create({name: 'g1'})]}
+
+      it('g1 has 1 override', function () {
+        expect(this.configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
       });
-      installerStep7Controller.switchConfigGroupConfigs();
-      var configs = installerStep7Controller.get('selectedService.configs');
-      expect(configs.findProperty('name', 'g1').get('overrides').length).to.equal(1);
-      expect(configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
-      expect(configs.everyProperty('isEditable', true)).to.equal(true);
-      installerStep7Controller._getDisplayedConfigGroups.restore();
-      installerStep7Controller._setEditableValue.restore();
+
+      it('g2 has 1 override', function () {
+        expect(this.configs.findProperty('name', 'g2').get('overrides').length).to.equal(1);
+      });
+
+      it('all configs are editable', function () {
+        expect(this.configs.everyProperty('isEditable', true)).to.equal(true);
+      });
+
     });
+
   });
 
   describe('#selectProperService', function () {
@@ -792,23 +815,32 @@ describe('App.InstallerStep7Controller', function () {
           e: 'n3'
         }
       ]).forEach(function (test) {
-        it(test.name, function () {
-          sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
-          installerStep7Controller.reopen({
-            wizardController: Em.Object.create({
-              name: test.name
-            }),
-            stepConfigs: test.stepConfigs
+        describe(test.name, function () {
+
+          beforeEach(function () {
+            sinon.stub(installerStep7Controller, 'selectedServiceObserver', Em.K);
+            installerStep7Controller.reopen({
+              wizardController: Em.Object.create({
+                name: test.name
+              }),
+              stepConfigs: test.stepConfigs
+            });
+            installerStep7Controller.selectProperService();
+          });
+
+          afterEach(function () {
+            installerStep7Controller.selectedServiceObserver.restore();
+          });
+
+          it('selected service name is valid', function () {
+            expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
           });
-          installerStep7Controller.selectProperService();
-          expect(installerStep7Controller.get('selectedService.name')).to.equal(test.e);
-          installerStep7Controller.selectedServiceObserver.restore();
         });
       });
   });
 
   describe.skip('#setStepConfigs', function () {
-
+    var serviceConfigs;
     beforeEach(function () {
       installerStep7Controller.reopen({
         content: {services: []},
@@ -818,45 +850,39 @@ describe('App.InstallerStep7Controller', function () {
           }
         })
       });
+      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
+        return serviceConfigs;
+      });
+      this.stub = sinon.stub(App, 'get');
     });
 
     afterEach(function () {
       installerStep7Controller.renderConfigs.restore();
+      App.get.restore();
     });
 
     it('if wizard isn\'t addService, should set output of installerStep7Controller.renderConfigs', function () {
-      var serviceConfigs = Em.A([
+      serviceConfigs = Em.A([
         {serviceName:'HDFS', configs: []},
         {}
       ]);
-      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
-        return serviceConfigs;
-      });
       installerStep7Controller.set('wizardController.name', 'installerController');
       installerStep7Controller.setStepConfigs([], []);
       expect(installerStep7Controller.get('stepConfigs')).to.eql(serviceConfigs);
     });
 
     it('addServiceWizard used', function () {
-      var serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
+      serviceConfigs = Em.A([Em.Object.create({serviceName: 'HDFS', configs: []}), Em.Object.create({serviceName: 's2'})]);
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['s2']});
-      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
-        return serviceConfigs;
-      });
       installerStep7Controller.setStepConfigs([], []);
       expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
       expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 's2').get('selected')).to.equal(true);
     });
 
     it('addServiceWizard used, HA enabled', function () {
-      sinon.stub(App, 'get', function (k) {
-        if (k === 'isHaEnabled') {
-          return true;
-        }
-        return Em.get(App, k);
-      });
-      var serviceConfigs = Em.A([
+      this.stub.withArgs('isHaEnabled').returns(true);
+      serviceConfigs = Em.A([
         Em.Object.create({
           serviceName: 'HDFS',
           configs: [
@@ -871,23 +897,18 @@ describe('App.InstallerStep7Controller', function () {
       );
       installerStep7Controller.set('wizardController.name', 'addServiceController');
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
-        return serviceConfigs;
-      });
       installerStep7Controller.setStepConfigs([], []);
       expect(installerStep7Controller.get('stepConfigs').everyProperty('showConfig', true)).to.equal(true);
       expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('selected')).to.equal(true);
       expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(5);
-      App.get.restore();
     });
 
     it('not windows stack', function () {
 
-      var s = sinon.stub(App, 'get');
-      s.withArgs('isHadoopWindowsStack').returns(false);
-      s.withArgs('isHaEnabled').returns(false);
+      this.stub.withArgs('isHadoopWindowsStack').returns(false);
+      this.stub.withArgs('isHaEnabled').returns(false);
 
-      var serviceConfigs = Em.A([
+      serviceConfigs = Em.A([
         Em.Object.create({
           serviceName: 'HDFS',
           configs: [
@@ -897,26 +918,17 @@ describe('App.InstallerStep7Controller', function () {
         }),
         Em.Object.create({serviceName: 's2'})]
       );
-
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
-      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
-        return serviceConfigs;
-      });
       installerStep7Controller.setStepConfigs([], []);
-
       expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
-
-      s.restore();
-
     });
 
     it('windows stack', function () {
 
-      var s = sinon.stub(App, 'get');
-      s.withArgs('isHadoopWindowsStack').returns(true);
-      s.withArgs('isHaEnabled').returns(false);
+      this.stub.withArgs('isHadoopWindowsStack').returns(true);
+      this.stub.withArgs('isHaEnabled').returns(false);
 
-      var serviceConfigs = Em.A([
+      serviceConfigs = Em.A([
         Em.Object.create({
           serviceName: 'HDFS',
           configs: [
@@ -929,15 +941,10 @@ describe('App.InstallerStep7Controller', function () {
 
       installerStep7Controller.reopen({selectedServiceNames: ['HDFS', 's2']});
       installerStep7Controller.set('installedServiceNames',['HDFS', 's2', 's3']);
-      sinon.stub(installerStep7Controller, 'renderConfigs', function () {
-        return serviceConfigs;
-      });
       installerStep7Controller.setStepConfigs([], []);
 
       expect(installerStep7Controller.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs').length).to.equal(2);
 
-      s.restore();
-
     });
 
   });
@@ -946,6 +953,10 @@ describe('App.InstallerStep7Controller', function () {
     beforeEach(function () {
       sinon.stub(installerStep7Controller, 'loadConfigGroups', Em.K);
       sinon.stub(installerStep7Controller, 'loadInstalledServicesConfigGroups', Em.K);
+      sinon.stub(App, 'get', function (k) {
+        if (k === 'supports.hostOverridesInstaller') return false;
+        return Em.get(App, k);
+      });
     });
     afterEach(function () {
       installerStep7Controller.loadConfigGroups.restore();
@@ -980,29 +991,37 @@ describe('App.InstallerStep7Controller', function () {
           }
         }
       ]).forEach(function (test) {
-        it(test.m, function () {
-          sinon.stub(App, 'get', function (k) {
-            if (k === 'supports.hostOverridesInstaller') return test.hostOverridesInstaller;
-            return Em.get(App, k);
-          });
-          installerStep7Controller.reopen({
-            installedServiceNames: test.installedServiceNames,
-            wizardController: {
-              areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
-            }
+        describe(test.m, function () {
+
+          beforeEach(function () {
+            installerStep7Controller.reopen({
+              installedServiceNames: test.installedServiceNames,
+              wizardController: {
+                areInstalledConfigGroupsLoaded: test.areInstalledConfigGroupsLoaded
+              }
+            });
+            installerStep7Controller.checkHostOverrideInstaller();
           });
-          installerStep7Controller.checkHostOverrideInstaller();
+
           if (test.e.loadConfigGroups) {
-            expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
+            it('loadConfigGroups is called once', function () {
+              expect(installerStep7Controller.loadConfigGroups.calledOnce).to.equal(true);
+            });
           }
           else {
-            expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
+            it('loadConfigGroups is not called', function () {
+              expect(installerStep7Controller.loadConfigGroups.called).to.equal(false);
+            });
           }
           if (test.e.loadInstalledServicesConfigGroups) {
-            expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
+            it('loadInstalledServicesConfigGroups is called once', function () {
+              expect(installerStep7Controller.loadInstalledServicesConfigGroups.calledOnce).to.equal(true);
+            });
           }
           else {
-            expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
+            it('loadInstalledServicesConfigGroups is not called', function () {
+              expect(installerStep7Controller.loadInstalledServicesConfigGroups.called).to.equal(false);
+            });
           }
         });
       });
@@ -1081,7 +1100,9 @@ describe('App.InstallerStep7Controller', function () {
           }
         }
       });
+      installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
     });
+
     afterEach(function () {
       App.config.fileConfigsIntoTextarea.restore();
       installerStep7Controller.loadServerSideConfigsRecommendations.restore();
@@ -1091,11 +1112,16 @@ describe('App.InstallerStep7Controller', function () {
       App.StackService.find.restore();
     });
 
-    it('should run some methods' , function () {
-     installerStep7Controller.applyServicesConfigs([{name: 'configs'}]);
+    it('loadServerSideConfigsRecommendations is called once' , function () {
      expect(installerStep7Controller.loadServerSideConfigsRecommendations.calledOnce).to.equal(true);
+    });
+    it('isRecommendedLoaded is true' , function () {
      expect(installerStep7Controller.get('isRecommendedLoaded')).to.equal(true);
+    });
+    it('checkHostOverrideInstalleris called once' , function () {
      expect(installerStep7Controller.checkHostOverrideInstaller.calledOnce).to.equal(true);
+    });
+    it('selectProperServiceis called once' , function () {
      expect(installerStep7Controller.selectProperService.calledOnce).to.equal(true);
     });
 
@@ -1176,44 +1202,77 @@ describe('App.InstallerStep7Controller', function () {
       expect(serviceConfigProperty.get('overrides')).to.eql(Em.A([]));
     });
 
-    it('host overrides not supported', function () {
+    describe('host overrides not supported', function () {
       var serviceConfigProperty = Em.Object.create({
         overrides: [
           {value: 'new value'}
         ]
-      }), component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
-      installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
-      expect(serviceConfigProperty.get('overrides').length).to.equal(1);
-      expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
-      expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
-      expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
-    });
+      });
+      var component = Em.Object.create({selectedConfigGroup: {isDefault: false}});
 
-    it('host overrides supported', function () {
-      sinon.stub(App, 'get', function (k) {
-        if (k === 'supports.hostOverrides') return true;
-        return Em.get(App, k);
+      beforeEach(function () {
+        installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
       });
-      var serviceConfigProperty = Em.Object.create({
+      it('there is 1 override', function () {
+        expect(serviceConfigProperty.get('overrides').length).to.equal(1);
+      });
+      it('override value is valid', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
+      });
+      it('override is not original SCP', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
+      });
+      it('override is linked to parent', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
+      });
+    });
+
+    describe('host overrides supported', function () {
+      var serviceConfigProperty;
+      var component;
+      beforeEach(function () {
+        sinon.stub(App, 'get', function (k) {
+          if (k === 'supports.hostOverrides') return true;
+          return Em.get(App, k);
+        });
+        serviceConfigProperty = Em.Object.create({
           overrides: [
             {value: 'new value', group: Em.Object.create({name: 'n1'})}
           ]
-        }),
+        });
         component = Em.Object.create({
           selectedConfigGroup: {isDefault: true},
           configGroups: Em.A([
             Em.Object.create({name: 'n1', properties: []})
           ])
         });
-      installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
-      App.get.restore();
-      expect(serviceConfigProperty.get('overrides').length).to.equal(1);
-      expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
-      expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
-      expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
-      expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
-      expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
-      expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
+        installerStep7Controller._updateOverridesForConfig(serviceConfigProperty, component);
+      });
+
+      afterEach(function () {
+        App.get.restore();
+      });
+      it('there is 1 override', function () {
+        expect(serviceConfigProperty.get('overrides').length).to.equal(1);
+      });
+      it('override.value is valid', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.value')).to.equal('new value');
+      });
+      it('override is not original SCP', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.isOriginalSCP')).to.equal(false);
+      });
+      it('override.parentSCP is valid', function () {
+        expect(serviceConfigProperty.get('overrides.firstObject.parentSCP')).to.eql(serviceConfigProperty);
+      });
+      it('there is 1 property in the config group', function () {
+        expect(component.get('configGroups.firstObject.properties').length).to.equal(1);
+      });
+      it('property in the config group is not editable', function () {
+        expect(component.get('configGroups.firstObject.properties.firstObject.isEditable')).to.equal(false);
+      });
+      it('property in the config group is linked to it', function () {
+        expect(component.get('configGroups.firstObject.properties.firstObject.group')).to.be.object;
+      });
     });
 
   });
@@ -1259,14 +1318,27 @@ describe('App.InstallerStep7Controller', function () {
       ],
       installedServiceNames = ['HBASE', 'AMBARI_METRICS'];
 
-    it('should handle properties with the same name', function () {
-      controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
-      var properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
-      expect(properties).to.have.length(2);
-      expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
-      expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
-      expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
-      expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
+    describe('should handle properties with the same name', function () {
+      var properties;
+      beforeEach(function () {
+        controller.setInstalledServiceConfigs(configs, configsByTags, installedServiceNames);
+        properties = configs.filterProperty('name', 'hbase.client.scanner.caching');
+      });
+      it('there are 2 properties', function () {
+        expect(properties).to.have.length(2);
+      });
+      it('hbase-site/ value is valid', function () {
+        expect(properties.findProperty('filename', 'hbase-site.xml').value).to.equal('1500');
+      });
+      it('hbase-site/ savedValue is valid', function () {
+        expect(properties.findProperty('filename', 'hbase-site.xml').savedValue).to.equal('1500');
+      });
+      it('ams-hbase-site/ value is valid', function () {
+        expect(properties.findProperty('filename', 'ams-hbase-site.xml').value).to.equal('2500');
+      });
+      it('ams-hbase-site/ savedValue is valid', function () {
+        expect(properties.findProperty('filename', 'ams-hbase-site.xml').savedValue).to.equal('2500');
+      });
     });
 
   });
@@ -1370,13 +1442,22 @@ describe('App.InstallerStep7Controller', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        var popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
-        expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
-        popup[item.method]();
-        expect(testObject.isResolved).to.equal(item.isResolved);
-        expect(testObject.isRejected).to.equal(item.isRejected);
-        expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
+      describe(item.title, function () {
+        var popup;
+        beforeEach(function () {
+          popup = installerStep7Controller.showDatabaseConnectionWarningPopup(serviceNames, dfd);
+        });
+
+        it('popup body is valid', function () {
+          expect(popup.get('body')).to.equal(Em.I18n.t('installer.step7.popup.database.connection.body').format(bodyMessage));
+        });
+
+        it('after ' + item.method + ' execution', function () {
+          popup[item.method]();
+          expect(testObject.isResolved).to.equal(item.isResolved);
+          expect(testObject.isRejected).to.equal(item.isRejected);
+          expect(installerStep7Controller.get('submitButtonClicked')).to.equal(item.submitButtonClicked);
+        });
       });
     });
 
@@ -1600,10 +1681,12 @@ describe('App.InstallerStep7Controller', function () {
 
   describe('#showOozieDerbyWarning', function() {
     var controller;
+
     beforeEach(function() {
       controller = App.WizardStep7Controller.create({});
       sinon.stub(App.ModalPopup, 'show', Em.K);
     });
+
     afterEach(function() {
       App.ModalPopup.show.restore();
     });
@@ -1628,15 +1711,23 @@ describe('App.InstallerStep7Controller', function () {
         m: 'Oozie selected, mysql database used, warning popup should be sk'
       }
     ]).forEach(function(test) {
-      it(test.m, function() {
-        var callback = sinon.spy();
-        sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
-        controller.reopen({
-          selectedServiceNames: test.selectedServiceNames
+      describe(test.m, function() {
+
+        beforeEach(function () {
+          sinon.stub(controller, 'findConfigProperty').returns(Em.Object.create({ value: test.databaseType}));
+          controller.reopen({
+            selectedServiceNames: test.selectedServiceNames
+          });
+          controller.showOozieDerbyWarningPopup(Em.K);
+        });
+
+        afterEach(function () {
+          controller.findConfigProperty.restore();
+        });
+
+        it('modal popup is shown needed number of times', function () {
+          expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
         });
-        controller.showOozieDerbyWarningPopup(callback);
-        controller.findConfigProperty.restore();
-        expect(App.ModalPopup.show.calledOnce).to.equal(test.e);
       });
     });
   });