ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject [3/3] ambari git commit: AMBARI-14741. Ambari Web Unit Test failure on trunk (App.WizardStep8Controller) (onechiporenko)
Date Wed, 20 Jan 2016 17:21:12 GMT
AMBARI-14741. Ambari Web Unit Test failure on trunk (App.WizardStep8Controller) (onechiporenko)


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

Branch: refs/heads/trunk
Commit: ddf479ef9ef1f4754cbfae075f0a9f36d99c901e
Parents: 9f76f60
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Jan 20 17:30:49 2016 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Jan 20 19:19:39 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  43 ++++
 ambari-web/app/router.js                        |   3 +
 ambari-web/app/utils/ajax/ajax.js               |   6 +-
 ambari-web/app/utils/ajax/ajax_queue.js         |  28 +--
 ambari-web/app/utils/helper.js                  |   2 +-
 ambari-web/package.json                         |   2 +-
 ambari-web/test/controllers/application_test.js |  24 +--
 .../global/background_operations_test.js        |  19 +-
 .../global/cluster_controller_test.js           |  71 +++----
 .../global/update_controller_test.js            |  23 +--
 .../global/user_settings_controller_test.js     |   4 -
 ambari-web/test/controllers/installer_test.js   |  10 -
 .../progress_controller_test.js                 |  11 +-
 .../progress_popup_controller_test.js           |  43 +---
 .../resourceManager/step3_controller_test.js    |  11 +-
 .../controllers/main/admin/kerberos_test.js     |  30 +--
 .../admin/stack_and_upgrade_controller_test.js  | 175 ++++++----------
 .../main/alert_definitions_controller_test.js   |   9 +-
 .../add_alert_definition_controller_test.js     |  20 +-
 .../alerts/alert_instances_controller_test.js   |  21 +-
 .../definitions_configs_controller_test.js      |  10 +-
 .../definitions_details_controller_test.js      |  37 +---
 ...anage_alert_notifications_controller_test.js |  15 +-
 .../controllers/main/charts/heatmap_test.js     |  61 ++----
 .../dashboard/config_history_controller_test.js |  26 +--
 .../main/host/add_controller_test.js            |  42 ++--
 .../test/controllers/main/host/details_test.js  | 197 +++++++++---------
 ambari-web/test/controllers/main/host_test.js   |  14 +-
 .../main/service/add_controller_test.js         |  75 +------
 .../main/service/info/config_test.js            |  21 +-
 .../main/service/info/summary_test.js           | 107 +---------
 .../test/controllers/main/service/item_test.js  |  27 +--
 .../service/reassign/step1_controller_test.js   |  27 +--
 .../service/reassign/step4_controller_test.js   | 201 +++++++++----------
 .../service/reassign/step6_controller_test.js   |  24 ++-
 .../service/reassign/step7_controller_test.js   |  53 +++--
 .../test/controllers/main/service_test.js       |  31 +--
 .../controllers/main/views_controller_test.js   |   9 +-
 ambari-web/test/controllers/main_test.js        |  25 +--
 .../test/controllers/wizard/step2_test.js       |  11 +-
 .../test/controllers/wizard/step3_test.js       |  95 ++-------
 .../test/controllers/wizard/step6_test.js       |   9 -
 .../test/controllers/wizard/step7_test.js       |  18 +-
 .../test/controllers/wizard/step8_test.js       |  85 ++------
 .../test/controllers/wizard/step9_test.js       |  31 +--
 ambari-web/test/controllers/wizard_test.js      |   8 +-
 ambari-web/test/helpers.js                      |  77 +++++++
 .../common/table_server_view_mixin_test.js      |   1 +
 .../test/mixins/common/widget_mixin_test.js     |  91 ++++-----
 .../common/widgets/export_metrics_mixin_test.js |  15 +-
 .../host_components/decommissionable_test.js    |  25 +--
 .../host_components/install_component_test.js   |  97 ++++-----
 .../wizard/wizardProgressPageController_test.js |  24 +--
 ambari-web/test/models/cluster_states_test.js   |   2 -
 ambari-web/test/models/host_test.js             |   4 -
 ambari-web/test/router_test.js                  |  40 +---
 ambari-web/test/utils/ajax/ajax_queue_test.js   |   8 -
 ambari-web/test/utils/ajax/ajax_test.js         |  17 +-
 .../test/utils/batch_scheduled_requests_test.js |  71 -------
 .../test/utils/host_progress_popup_test.js      |   2 -
 ambari-web/test/utils/updater_test.js           | 149 +++++++-------
 .../test/views/common/chart/linear_time_test.js |  16 +-
 .../common/configs/config_history_flow_test.js  |  12 +-
 .../test/views/common/controls_view_test.js     |   9 +-
 .../test/views/common/quick_link_view_test.js   |  59 ++----
 .../common/widget/gauge_widget_view_test.js     |  24 ++-
 .../common/widget/graph_widget_view_test.js     |  12 +-
 .../common/widget/number_widget_view_test.js    |  24 ++-
 .../stack_upgrade/upgrade_group_view_test.js    |  16 +-
 .../stack_upgrade/upgrade_wizard_view_test.js   | 107 ++++++----
 .../admin/stack_upgrade/version_view_test.js    |  85 ++++----
 .../test/views/main/dashboard/widget_test.js    |  11 +-
 .../main/dashboard/widgets/namenode_cpu_test.js |  31 ++-
 .../test/views/main/dashboard/widgets_test.js   |  18 +-
 .../host_component_views/datanode_view_test.js  |  15 +-
 .../decommissionable_test.js                    |  28 +--
 .../views/main/service/services/ranger_test.js  |  10 -
 77 files changed, 1151 insertions(+), 1763 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index d6b0de8..2b801f0 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -341,9 +341,52 @@ var files = [
   'test/views/main/service/menu_test'
 ];
 
+var ajaxSendMock = {
+  complete: Em.K,
+  success: Em.K,
+  then: Em.K,
+  promise: Em.K,
+  done: Em.clb,
+  error: Em.K,
+  retry: function () {
+    return {
+      then: Em.K,
+      complete: Em.K
+    }
+  },
+  fail: Em.K,
+  always: Em.clb
+};
+
+// don't poll anything while test are running
+App.bgOperationsUpdateInterval = 3600000;
+App.componentsUpdateInterval = 3600000;
+App.contentUpdateInterval = 3600000;
+App.hostStatusCountersUpdateInterval = 3600000;
+App.alertDefinitionsUpdateInterval = 3600000;
+App.alertInstancesUpdateInterval = 3600000;
+App.alertGroupsUpdateInterval = 3600000;
+
 App.initialize();
 describe('Ambari Web Unit tests', function() {
 
+  beforeEach(function () {
+    App.set('testMode', false); // don't even try to write tests for testMode = true
+    sinon.stub($, 'ajax', Em.K);
+    sinon.stub(App.ajax, 'send', function () {
+      return ajaxSendMock;
+    });
+    sinon.stub(App.updater, 'run', Em.K);
+    sinon.stub(App.updater, 'immediateRun', Em.K);
+  });
+
+  afterEach(function () {
+    App.ajax.send.restore();
+    $.ajax.restore();
+    App.updater.run.restore();
+    App.updater.immediateRun.restore();
+  });
+
   files.forEach(function (file) {
     describe(file, function() {
       require(file);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 92b2bae..c7f59c0 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -687,6 +687,9 @@ App.Router = Em.Router.extend({
        *  If the user is already logged in, redirect to where the user was previously
        */
       enter: function (router, context) {
+        if ($.mocho) {
+          return;
+        }
         var location = router.location.location.hash;
         router.getAuthenticated().done(function (loggedIn) {
           if (loggedIn) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index a7c9e4e..4762d34 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2808,7 +2808,6 @@ var formatRequest = function (data) {
     type: this.type || 'GET',
     timeout: App.timeout,
     dataType: 'json',
-    statusCode: require('data/statusCodes'),
     headers: {}
   };
   if (App.get('testMode')) {
@@ -2823,6 +2822,11 @@ var formatRequest = function (data) {
   if (this.format) {
     jQuery.extend(opt, this.format(data, opt));
   }
+  var statusCode = jQuery.extend({}, require('data/statusCodes'));
+  statusCode['404'] = function () {
+    console.log("Error code 404: URI not found. -> " + opt.url);
+  };
+  opt.statusCode = statusCode;
   return opt;
 };
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/app/utils/ajax/ajax_queue.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax_queue.js b/ambari-web/app/utils/ajax/ajax_queue.js
index 7187788..1c2106f 100644
--- a/ambari-web/app/utils/ajax/ajax_queue.js
+++ b/ambari-web/app/utils/ajax/ajax_queue.js
@@ -152,19 +152,21 @@ App.ajaxQueue = Em.Object.extend({
     var r = App.ajax.send(queue.shift());
     this.propertyDidChange('queue');
     if (r) {
-      r.complete(function(xhr) {
-        if(xhr.status>=200 && xhr.status <= 299) {
-          self.runNextRequest();
-        }
-        else {
-          if (self.get('abortOnError')) {
-            self.clear();
-          }
-          else {
-            self.runNextRequest();
-          }
-        }
-      });
+      r.complete(this._complete);
+    }
+    else {
+      if (this.get('abortOnError')) {
+        this.clear();
+      }
+      else {
+        this.runNextRequest();
+      }
+    }
+  },
+
+  _complete: function(xhr) {
+    if(xhr.status>=200 && xhr.status <= 299) {
+      this.runNextRequest();
     }
     else {
       if (this.get('abortOnError')) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 296a8e8..a1d4b30 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -736,7 +736,7 @@ App.popover = function (self, options) {
  * @param {object} options
  */
 App.tooltip = function (self, options) {
-  if (!self) return;
+  if (!self || !self.tooltip) return;
   self.tooltip(options);
   /* istanbul ignore next */
   self.on("remove", function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-web/package.json b/ambari-web/package.json
index 10a9314..550d293 100644
--- a/ambari-web/package.json
+++ b/ambari-web/package.json
@@ -1,7 +1,7 @@
 {
   "name": "Ambari",
   "description": "Front-end package for the Apache Ambari Project",
-  "version": "2.2.0",
+  "version": "2.4.0",
   "homepage": "http://ambari.apache.org/",
   "repository": {
     "type": "git",

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/application_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/application_test.js b/ambari-web/test/controllers/application_test.js
index efe5103..cdeb06e 100644
--- a/ambari-web/test/controllers/application_test.js
+++ b/ambari-web/test/controllers/application_test.js
@@ -19,6 +19,7 @@
 
 var App = require('app');
 require('models/cluster');
+var testHelpers = require('test/helpers');
 
 function getController() {
   return App.ApplicationController.create();
@@ -90,30 +91,15 @@ describe('App.ApplicationController', function () {
   });
 
   describe('#getStack', function() {
-    var res;
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function(data) {
-        res = data;
-      });
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
+
     it ('Should return send value', function() {
       var callback = {
         'callback': true
       };
       applicationController.getStack(callback);
-      res = JSON.parse(JSON.stringify(res));
-      expect(res).to.be.eql({
-        "name": "router.login.clusters",
-        "sender": {
-          "isPollerRunning": true
-        },
-        "callback": {
-          "callback": true
-        }
-      });
+      var args = testHelpers.findAjaxRequest('name', 'router.login.clusters');
+      expect(args[0]).to.exists;
+      expect(args[0].callback.callback).to.be.true;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/global/background_operations_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/background_operations_test.js b/ambari-web/test/controllers/global/background_operations_test.js
index a602a32..445eeb0 100644
--- a/ambari-web/test/controllers/global/background_operations_test.js
+++ b/ambari-web/test/controllers/global/background_operations_test.js
@@ -41,7 +41,6 @@ describe('App.BackgroundOperationsController', function () {
      *
      */
     App.set('clusterName', 'testName');
-    App.bgOperationsUpdateInterval = 100;
 
     var tests = Em.A([
       {
@@ -112,13 +111,6 @@ describe('App.BackgroundOperationsController', function () {
       }
     ]);
 
-    beforeEach(function () {
-      App.testMode = false;
-    });
-    afterEach(function () {
-      App.testMode = true;
-    });
-
     tests.forEach(function (test) {
       it(test.m, function () {
         controller.set('levelInfo', test.levelInfo);
@@ -133,11 +125,9 @@ describe('App.BackgroundOperationsController', function () {
   describe('#startPolling()', function () {
 
     beforeEach(function () {
-      sinon.spy(App.updater, 'run');
       sinon.spy(controller, 'requestMostRecent');
     });
     afterEach(function () {
-      App.updater.run.restore();
       controller.requestMostRecent.restore();
     });
 
@@ -177,6 +167,15 @@ describe('App.BackgroundOperationsController', function () {
   });
 
   describe('#callBackForMostRecent()', function () {
+
+    beforeEach(function () {
+      sinon.stub(App.router.get('clusterController'), 'restoreUpgradeState', Em.K);
+    });
+
+    afterEach(function () {
+      App.router.get('clusterController').restoreUpgradeState.restore();
+    });
+
     it('No requests exists', function () {
       var data = {
         items: []

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 f72d64f..a791b19 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -19,6 +19,7 @@
 
 var App = require('app');
 var credentialUtils = require('utils/credentials');
+var testHelpers = require('test/helpers');
 require('controllers/global/cluster_controller');
 require('models/host_component');
 require('utils/http_client');
@@ -74,6 +75,7 @@ describe('App.clusterController', function () {
 
     beforeEach(function () {
       modelSetup.setupStackVersion(this, 'HDP-2.0.5');
+      App.ajax.send.restore(); // default ajax-mock can't be used here
       sinon.stub(App.ajax, 'send', function () {
         return {
           then: function (successCallback) {
@@ -83,22 +85,22 @@ describe('App.clusterController', function () {
           }
         }
       });
+      this.args = testHelpers.findAjaxRequest('name', 'cluster.load_cluster_name');
     });
     afterEach(function () {
       modelSetup.restoreStackVersion(this);
-      App.ajax.send.restore();
     });
 
     it('if clusterName is "mycluster" and reload is false then clusterName stays the same', function () {
       App.set('clusterName', 'mycluster');
       controller.loadClusterName(false);
-      expect(App.ajax.send.called).to.be.false;
+      expect(this.args).to.not.exists;
       expect(App.get('clusterName')).to.equal('mycluster');
     });
 
     it('reload is true and clusterName is not empty', function () {
       controller.loadClusterName(true);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(this.args).to.exists;
       expect(App.get('clusterName')).to.equal('clusterNameFromServer');
       expect(App.get('currentStackVersion')).to.equal('HDP-2.0.5');
     });
@@ -106,7 +108,7 @@ describe('App.clusterController', function () {
     it('reload is false and clusterName is empty', function () {
       App.set('clusterName', '');
       controller.loadClusterName(false);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      expect(this.args).to.exists;
       expect(App.get('clusterName')).to.equal('clusterNameFromServer');
       expect(App.get('currentStackVersion')).to.equal('HDP-2.0.5');
     });
@@ -187,14 +189,8 @@ describe('App.clusterController', function () {
   describe('#getUrl', function () {
     controller.set('clusterName', 'tdk');
     var tests = ['test1', 'test2', 'test3'];
-    it('testMode = true', function () {
-      App.testMode = true;
-      tests.forEach(function (test) {
-        expect(controller.getUrl(test, test)).to.equal(test);
-      });
-    });
+
     it('testMode = false', function () {
-      App.testMode = false;
       tests.forEach(function (test) {
         expect(controller.getUrl(test, test)).to.equal(App.apiPrefix + '/clusters/' + controller.get('clusterName') + test);
       });
@@ -204,9 +200,6 @@ describe('App.clusterController', function () {
   describe("#createKerberosAdminSession()", function() {
 
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function() {
-        return {success: Em.K}
-      });
       sinon.stub(credentialUtils, 'createOrUpdateCredentials', function() {
         return $.Deferred().resolve().promise();
       });
@@ -215,7 +208,6 @@ describe('App.clusterController', function () {
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       credentialUtils.createOrUpdateCredentials.restore();
       App.get.restore();
     });
@@ -227,18 +219,16 @@ describe('App.clusterController', function () {
         key: 'pass',
         type: 'persistent'
       }, {});
-
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'common.cluster.update',
-        sender: controller,
-        data: {
-          clusterName: 'test',
-          data: [{
-            session_attributes: {
-              kerberos_admin: {principal: "admin", password: "pass"}
-            }
-          }]
-        }
+      var args = testHelpers.findAjaxRequest('name', 'common.cluster.update');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        clusterName: 'test',
+        data: [{
+          session_attributes: {
+            kerberos_admin: {principal: "admin", password: "pass"}
+          }
+        }]
       });
     });
     it("KDC Store supports enabled, credentials updated via credentials storage call", function() {
@@ -248,7 +238,8 @@ describe('App.clusterController', function () {
         key: 'pass',
         type: 'persistent'
       }, {});
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.cluster.update');
+      expect(args).to.not.exists;
       expect(credentialUtils.createOrUpdateCredentials.getCall(0).args).to.eql([
         'test', 'kdc.admin.credential', {
           principal: 'admin',
@@ -282,14 +273,7 @@ describe('App.clusterController', function () {
       }
     ];
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send').returns({
-        promise: Em.K
-      });
-    });
-
     afterEach(function () {
-      App.ajax.send.restore();
       App.get.restore();
     });
 
@@ -301,7 +285,8 @@ describe('App.clusterController', function () {
 
       it('request is sent', function () {
         controller.checkDetailedRepoVersion();
-        expect(App.ajax.send.calledOnce).to.be.true;
+        var args = testHelpers.findAjaxRequest('name', 'cluster.load_detailed_repo_version');
+        expect(args).to.exists;
       });
     });
 
@@ -316,7 +301,8 @@ describe('App.clusterController', function () {
         });
 
         it('request is not sent', function () {
-          expect(App.ajax.send.called).to.be.false;
+          var args = testHelpers.findAjaxRequest('name', 'cluster.load_detailed_repo_version');
+          expect(args).to.not.exists;
         });
 
         it('App.isStormMetricsSupported is ' + item.isStormMetricsSupported, function () {
@@ -438,17 +424,10 @@ describe('App.clusterController', function () {
 
   describe('#getAllUpgrades()', function () {
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should send request to get upgrades data', function () {
       controller.getAllUpgrades();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'cluster.load_last_upgrade');
+      expect(args).to.exists;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 25b2c5b..c0a4760 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -20,6 +20,7 @@
 var App = require('app');
 require('utils/updater');
 require('controllers/global/update_controller');
+var testHelpers = require('test/helpers');
 
 describe('App.UpdateController', function () {
   var controller = App.UpdateController.create({
@@ -34,14 +35,6 @@ describe('App.UpdateController', function () {
 
   describe('#getUrl()', function () {
 
-    beforeEach(function () {
-      sinon.stub(App, 'get').withArgs('testMode').returns(false);
-    });
-
-    afterEach(function () {
-      App.get.restore();
-    });
-
     it('testMode = false', function () {
       expect(controller.getUrl('test', '/real')).to.equal('/api/v1/clusters//real');
     });
@@ -54,12 +47,6 @@ describe('App.UpdateController', function () {
 
   describe('#updateAll()', function () {
 
-    beforeEach(function () {
-      sinon.stub(App.updater, 'run', Em.K);
-    });
-    afterEach(function () {
-      App.updater.run.restore();
-    });
     it('isWorking = false', function () {
       controller.set('isWorking', false);
       expect(App.updater.run.called).to.equal(false);
@@ -266,23 +253,23 @@ describe('App.UpdateController', function () {
       this.mock = sinon.stub(App.Service, 'find');
       sinon.stub(controller, 'computeParameters');
       sinon.stub(controller, 'addParamsToHostsUrl');
-      sinon.stub(App.ajax, 'send');
     });
     afterEach(function () {
       App.Service.find.restore();
       controller.computeParameters.restore();
       controller.addParamsToHostsUrl.restore();
-      App.ajax.send.restore();
     });
     it("AMBARI_METRICS is not started", function () {
       this.mock.returns(Em.Object.create({isStarted: false}));
       expect(controller.loadHostsMetric([])).to.be.null;
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'hosts.metrics.lazy_load');
+      expect(args).to.not.exists;
     });
     it("AMBARI_METRICS is started", function () {
       this.mock.returns(Em.Object.create({isStarted: true}));
       expect(controller.loadHostsMetric([])).to.be.object;
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'hosts.metrics.lazy_load');
+      expect(args).to.exists;
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/global/user_settings_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/user_settings_controller_test.js b/ambari-web/test/controllers/global/user_settings_controller_test.js
index 7c49645..849fb2f 100644
--- a/ambari-web/test/controllers/global/user_settings_controller_test.js
+++ b/ambari-web/test/controllers/global/user_settings_controller_test.js
@@ -22,14 +22,10 @@ var userSettingsController;
 describe('App.UserSettingsController', function () {
 
   beforeEach(function () {
-    sinon.stub(App.ajax, 'send', function () {
-      return {complete: Em.K}
-    });
     userSettingsController = App.UserSettingsController.create();
   });
 
   afterEach(function () {
-    App.ajax.send.restore();
     userSettingsController.destroy();
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 cd75ed7..df4ab0e 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -30,16 +30,6 @@ describe('App.InstallerController', function () {
     installerController.destroy();
   });
 
-  beforeEach(function () {
-    sinon.stub(App.ajax, 'send', function () {
-      return {complete: Em.K};
-    });
-  });
-
-  afterEach(function () {
-    App.ajax.send.restore();
-  });
-
   describe('#init', function () {
     var c;
     beforeEach(function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
index 1c4d584..f002754 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_controller_test.js
@@ -123,12 +123,15 @@ describe('App.HighAvailabilityProgressPageController', function () {
           }
         ]
       }];
-    beforeEach(function() {
-      App.set('testMode', true);
+
+    beforeEach(function () {
+      sinon.stub(Date.prototype, 'getTime').returns(1);
     });
-    afterEach(function() {
-      App.set('testMode', false);
+
+    afterEach(function () {
+      Date.prototype.getTime.restore();
     });
+
     it("reconfigures configs after HA", function() {
       tests.forEach(function(t) {
         controller.set('content', t.content);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 2a9a4d7..8648181 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
@@ -19,6 +19,7 @@
 var App = require('app');
 
 require('controllers/main/admin/highAvailability/progress_popup_controller');
+var testHelpers = require('test/helpers');
 
 describe('App.HighAvailabilityProgressPopupController', function () {
 
@@ -34,16 +35,6 @@ describe('App.HighAvailabilityProgressPopupController', function () {
 
   describe('#startTaskPolling', function () {
 
-    beforeEach(function () {
-      sinon.stub(App.updater, 'run', Em.K);
-      sinon.stub(App.updater, 'immediateRun', Em.K);
-    });
-
-    afterEach(function () {
-      App.updater.run.restore();
-      App.updater.immediateRun.restore();
-    });
-
     describe('should start task polling', function () {
 
       beforeEach(function () {
@@ -85,17 +76,10 @@ describe('App.HighAvailabilityProgressPopupController', function () {
 
   describe('#updateTask', function () {
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should send polling request', function () {
       controller.updateTask();
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'background_operations.get_by_task');
+      expect(args).to.exists;
     });
 
   });
@@ -200,14 +184,6 @@ describe('App.HighAvailabilityProgressPopupController', function () {
       }
     ];
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     cases.forEach(function (item) {
       describe(item.title, function () {
 
@@ -217,26 +193,29 @@ describe('App.HighAvailabilityProgressPopupController', function () {
             stageId: item.stageId
           });
           controller.getHosts();
+          this.bgArgs = testHelpers.filterAjaxRequests('name', 'background_operations.get_by_request');
+          this.pollingArgs = testHelpers.filterAjaxRequests('name', 'common.request.polling');
+          this.args = item.name === 'background_operations.get_by_request' ? this.bgArgs : this.pollingArgs;
         });
 
         it('two requests are sent', function () {
-          expect(App.ajax.send.calledTwice).to.be.true;
+          expect(this.args.length).to.be.equal(2);
         });
 
         it('1st call name is valid', function () {
-          expect(App.ajax.send.firstCall.args[0].name).to.equal(item.name);
+          expect(this.args[0][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);
+          expect(this.args[1][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);
+          expect(this.args[0][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);
+          expect(this.args[1][0].data.stageId).to.eql(item.stageIdPassed);
         });
 
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 9a24cf3..3e6f7bb 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
@@ -18,6 +18,7 @@
 
 var App = require('app');
 require('controllers/main/admin/highAvailability/resourceManager/step3_controller');
+var testHelpers = require('test/helpers');
 
 describe('App.RMHighAvailabilityWizardStep3Controller', function () {
 
@@ -54,14 +55,6 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
       content: Em.Object.create({})
     });
 
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should send proper ajax request', function () {
       controller.loadConfigTagsSuccessCallback({
         'Clusters': {
@@ -80,7 +73,7 @@ describe('App.RMHighAvailabilityWizardStep3Controller', function () {
       }, {}, {
         'serviceConfig': {}
       });
-      var data = App.ajax.send.args[0][0].data;
+      var data = testHelpers.findAjaxRequest('name', 'reassign.load_configs')[0].data;
       expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)|(type=yarn-site&tag=1)|(type=yarn-env&tag=1)');
       expect(data.serviceConfig).to.eql({});
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 fa23082..d347416 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+var testHelpers = require('test/helpers');
 
 describe('App.MainAdminKerberosController', function() {
 
@@ -131,13 +132,11 @@ describe('App.MainAdminKerberosController', function() {
 
     beforeEach(function () {
       sinon.spy(App.ModalPopup, "show");
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.spy(controller, 'restartServicesAfterRegenerate');
       sinon.spy(controller, 'restartAllServices');
     });
     afterEach(function () {
       App.ModalPopup.show.restore();
-      App.ajax.send.restore();
       controller.restartServicesAfterRegenerate.restore();
       controller.restartAllServices.restore();
     });
@@ -157,8 +156,8 @@ describe('App.MainAdminKerberosController', function() {
       var popup2 = popup.onPrimary();
       popup2.set('restartComponents', true)
       popup2.onPrimary();
-
-      expect(App.ajax.send.args[0][0].data.type).to.equal('missing');
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos_security.regenerate_keytabs');
+      expect(args[0].data.type).to.be.equal('missing');
     });
 
     it('user didn\'t check regeneration only for missing host/components', function () {
@@ -169,7 +168,8 @@ describe('App.MainAdminKerberosController', function() {
       popup2.set('restartComponents', true)
       popup2.onPrimary();
 
-      expect(App.ajax.send.args[0][0].data.type).to.equal('all');
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos_security.regenerate_keytabs');
+      expect(args[0].data.type).to.be.equal('all');
     });
 
     it('user checked restart services automatically', function () {
@@ -180,7 +180,8 @@ describe('App.MainAdminKerberosController', function() {
       popup2.set('restartComponents', true)
       popup2.onPrimary();
 
-      expect(App.ajax.send.args[0][0].data.withAutoRestart).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos_security.regenerate_keytabs');
+      expect(args[0].data.withAutoRestart).to.be.true;
     });
 
     it('user didn\'t check restart services automatically', function () {
@@ -191,7 +192,8 @@ describe('App.MainAdminKerberosController', function() {
       popup2.set('restartComponents', false)
       popup2.onPrimary();
 
-      expect(App.ajax.send.args[0][0].data.withAutoRestart).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'admin.kerberos_security.regenerate_keytabs');
+      expect(args[0].data.withAutoRestart).to.be.false;
     });
   });
 
@@ -200,7 +202,6 @@ describe('App.MainAdminKerberosController', function() {
     var mock = {callback: Em.K};
 
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.spy(mock, 'callback');
       sinon.stub(controller, 'getSecurityType', function (c) {
         c();
@@ -208,7 +209,6 @@ describe('App.MainAdminKerberosController', function() {
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       mock.callback.restore();
       controller.getSecurityType.restore();
       Em.tryInvoke(App.get, 'restore');
@@ -244,6 +244,7 @@ describe('App.MainAdminKerberosController', function() {
               controller.set('securityEnabled', test.securityEnabled);
               controller.set('kdc_type', test.kdc_type);
               controller.getKDCSessionState(mock.callback);
+              this.args = testHelpers.findAjaxRequest('name', 'kerberos.session.state');
             });
 
 
@@ -252,7 +253,7 @@ describe('App.MainAdminKerberosController', function() {
                 expect(mock.callback.calledOnce).to.be.false;
               });
               it('1 request is sent', function () {
-                expect(App.ajax.send.calledOnce).to.be.true;
+                expect(this.args).to.exists;
               });
             }
             else {
@@ -260,7 +261,7 @@ describe('App.MainAdminKerberosController', function() {
                 expect(mock.callback.calledOnce).to.be.true;
               });
               it('no request is sent', function () {
-                expect(App.ajax.send.calledOnce).to.be.false;
+                expect(this.args).to.not.exists;
               });
             }
           });
@@ -272,12 +273,10 @@ describe('App.MainAdminKerberosController', function() {
     var mock = {callback: Em.K};
 
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.spy(mock, 'callback');
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       mock.callback.restore();
       Em.tryInvoke(App.get, 'restore');
     });
@@ -312,6 +311,7 @@ describe('App.MainAdminKerberosController', function() {
               controller.set('securityEnabled', test.securityEnabled);
               controller.set('kdc_type', test.kdc_type);
               controller.getSecurityType(mock.callback);
+              this.args = testHelpers.findAjaxRequest('name', 'admin.security.cluster_configs.kerberos');
             });
 
             if (test.result) {
@@ -319,14 +319,14 @@ describe('App.MainAdminKerberosController', function() {
                 expect(mock.callback.calledOnce).to.be.false;
               });
               it('1 request is sent', function () {
-                expect(App.ajax.send.calledOnce).to.be.true;
+                expect(this.args).to.exists;
               });
             } 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;
+                expect(this.args).to.not.exists;
               });
             }
           });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 fe5d9c8..508e2dd 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
@@ -20,6 +20,7 @@
 var App = require('app');
 require('controllers/main/admin/stack_and_upgrade_controller');
 require('utils/string_utils');
+var testHelpers = require('test/helpers');
 
 describe('App.MainAdminStackAndUpgradeController', function() {
 
@@ -139,43 +140,34 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#loadUpgradeData()", function() {
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send').returns({
-        then: Em.K,
-        complete: Em.K
-      });
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
+
     it("get entire data", function() {
       controller.set('upgradeId', 1);
       controller.loadUpgradeData();
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'admin.upgrade.data',
-        sender: controller,
-        data: {
-          id: 1
-        },
-        success: 'loadUpgradeDataSuccessCallback'
-      })
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.data');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        id: 1
+      });
     });
     it("get only state", function() {
       controller.set('upgradeId', 1);
       controller.loadUpgradeData(true);
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'admin.upgrade.state',
-        sender: controller,
-        data: {
-          id: 1
-        },
-        success: 'loadUpgradeDataSuccessCallback'
-      })
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.state');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        id: 1
+      });
     });
     it("upgrade id is null", function() {
       controller.set('upgradeId', null);
       controller.loadUpgradeData();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.state');
+      var args2 = testHelpers.findAjaxRequest('name', 'admin.upgrade.data');
+      expect(args).to.not.exists;
+      expect(args2).to.not.exists;
     });
   });
 
@@ -263,12 +255,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#getUpgradeItem()", function() {
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
+
     it("default callback", function() {
       var item = Em.Object.create({
         request_id: 1,
@@ -276,15 +263,14 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         stage_id: 3
       });
       controller.getUpgradeItem(item);
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'admin.upgrade.upgrade_item',
-        sender: controller,
-        data: {
-          upgradeId: 1,
-          groupId: 2,
-          stageId: 3
-        },
-        success: 'getUpgradeItemSuccessCallback'
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.upgrade_item');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].success).to.be.equal('getUpgradeItemSuccessCallback');
+      expect(args[0].data).to.be.eql({
+        upgradeId: 1,
+        groupId: 2,
+        stageId: 3
       });
     });
     it("custom callback", function() {
@@ -294,15 +280,14 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         stage_id: 3
       });
       controller.getUpgradeItem(item, 'customCallback');
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'admin.upgrade.upgrade_item',
-        sender: controller,
-        data: {
-          upgradeId: 1,
-          groupId: 2,
-          stageId: 3
-        },
-        success: 'customCallback'
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.upgrade_item');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].success).to.be.equal('customCallback');
+      expect(args[0].data).to.be.eql({
+        upgradeId: 1,
+        groupId: 2,
+        stageId: 3
       });
     });
   });
@@ -321,12 +306,6 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#runPreUpgradeCheck()", function() {
-    before(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
     it("make ajax call", function() {
       controller.runPreUpgradeCheck(Em.Object.create({
         repositoryVersion: '2.2',
@@ -335,18 +314,15 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         skipComponentFailures: false,
         skipSCFailures: false
       }));
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: "admin.upgrade.pre_upgrade_check",
-        sender: controller,
-        data: {
-          value: '2.2',
-          label: 'HDP-2.2',
-          type: 'ROLLING',
-          skipComponentFailures: 'false',
-          skipSCFailures: 'false'
-        },
-        success: "runPreUpgradeCheckSuccess",
-        error: "runPreUpgradeCheckError"
+      var args = testHelpers.findAjaxRequest('name', 'admin.upgrade.pre_upgrade_check');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        value: '2.2',
+        label: 'HDP-2.2',
+        type: 'ROLLING',
+        skipComponentFailures: 'false',
+        skipSCFailures: 'false'
       });
     });
   });
@@ -526,7 +502,6 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     var callArgs;
 
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(controller, 'setDBProperty', Em.K);
       controller.set('currentVersion', {
         repository_version: '2.2'
@@ -535,11 +510,10 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         value: '2.2',
         label: 'HDP-2.2'
       });
-      callArgs = App.ajax.send.getCall(0).args[0];
+      callArgs = testHelpers.findAjaxRequest('name', 'admin.upgrade.start')[0];
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       controller.setDBProperty.restore();
     });
 
@@ -991,7 +965,6 @@ describe('App.MainAdminStackAndUpgradeController', function() {
 
   describe("#downgrade()", function() {
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       sinon.stub(controller, 'abortUpgrade');
       sinon.stub(App.RepositoryVersion, 'find').returns([
         Em.Object.create({
@@ -1005,11 +978,10 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         repository_version: '2.2',
         repository_name: 'HDP-2.2'
       }), {context: 'context'});
-      this.callArgs = App.ajax.send.getCall(0).args[0];
+      this.callArgs = testHelpers.findAjaxRequest('name', 'admin.downgrade.start')[0];
     });
 
     afterEach(function () {
-      App.ajax.send.restore();
       controller.abortUpgrade.restore();
       App.RepositoryVersion.find.restore();
     });
@@ -1018,7 +990,7 @@ describe('App.MainAdminStackAndUpgradeController', 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({
+      expect(this.callArgs.data).to.eql({
         from: '2.3',
         value: '2.2',
         label: 'HDP-2.2',
@@ -1056,12 +1028,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#installRepoVersion()", function () {
-    before(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
+
     it("make ajax call", function () {
       var repo = Em.Object.create({
         stackVersionType: 'HDP',
@@ -1070,7 +1037,8 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         repoId: 1
       });
       controller.installRepoVersion(repo);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.stack_version.install.repo_version');
+      expect(args).to.exists;
     });
   });
 
@@ -1109,22 +1077,13 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   describe("#setUpgradeItemStatus()", function () {
     var item;
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function () {
-        return {
-          done: Em.clb
-        }
-      });
       item = Em.Object.create({
         request_id: 1,
         stage_id: 1,
         group_id: 1
       });
       controller.setUpgradeItemStatus(item, 'PENDING');
-      this.callArgs = App.ajax.send.getCall(0).args[0];
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
+      this.callArgs = testHelpers.findAjaxRequest('name', 'admin.upgrade.upgradeItem.setState')[0];
     });
 
     it('request-data is valid', function () {
@@ -1222,12 +1181,10 @@ describe('App.MainAdminStackAndUpgradeController', function() {
     before(function(){
       this.mock = sinon.stub(controller, 'validateRepoVersions');
       sinon.stub(controller, 'prepareRepoForSaving', Em.K);
-      sinon.stub(App.ajax, 'send').returns({success: Em.K});
     });
     after(function(){
       this.mock.restore();
       controller.prepareRepoForSaving.restore();
-      App.ajax.send.restore();
     });
     describe("validation errors present", function() {
 
@@ -1236,6 +1193,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           done: function(callback) {callback([1]);}
         });
         controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true);
+        this.args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.edit.repo');
       });
 
       it('validateRepoVersions is called with valid arguments', function () {
@@ -1247,7 +1205,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       });
 
       it('no requests are sent', function () {
-        expect(App.ajax.send.called).to.be.false;
+        expect(this.args).to.not.exists;
       });
     });
 
@@ -1269,15 +1227,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   });
 
   describe("#validateRepoVersions()", function () {
-    before(function () {
-      sinon.stub(App.ajax, 'send').returns({success: Em.K, error: Em.K});
-    });
-    after(function () {
-      App.ajax.send.restore();
-    });
+
     it("skip validation", function () {
       controller.validateRepoVersions(Em.Object.create({repoVersionId: 1}), true);
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.validate.repo');
+      expect(args).to.not.exists;
     });
     it("do validation", function () {
       var repo = Em.Object.create({
@@ -1292,7 +1246,8 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         ]
       });
       controller.validateRepoVersions(repo, false);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'admin.stack_versions.validate.repo');
+      expect(args[0]).to.exists;
     });
   });
 
@@ -1304,6 +1259,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         realUpdateUrl: 'realUpdateUrl'
       });
     });
+
     it("full load is true, stack is null", function() {
       expect(controller.getUrl(null, true)).to.equal('realRepoUrl');
     });
@@ -1401,13 +1357,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
   describe('#updateFinalize', 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();
     });
 
@@ -1416,10 +1370,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       beforeEach(function () {
         this.stub.withArgs('upgradeState').returns('HOLDING');
         controller.updateFinalize();
+        this.args = testHelpers.findAjaxRequest('name', 'admin.upgrade.finalizeContext');
       });
 
       it('request is sent', function () {
-        expect($.ajax.calledOnce).to.be.true;
+        expect(this.args[0]).to.exists;
       });
 
     });
@@ -1429,10 +1384,11 @@ describe('App.MainAdminStackAndUpgradeController', function() {
       beforeEach(function () {
         this.stub.withArgs('upgradeState').returns('HOLDING_TIMEDOUT');
         controller.updateFinalize();
+        this.args = testHelpers.findAjaxRequest('name', 'admin.upgrade.finalizeContext');
       });
 
       it('request is not sent', function () {
-        expect($.ajax.called).to.be.false;
+        expect(this.args).to.not.exists;
       });
 
       it('isFinalizeItem is false', function () {
@@ -2052,12 +2008,12 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           action: 'a'
         });
       });
+      App.ajax.send.restore();
       sinon.stub(App.ajax, 'send').returns({});
     });
 
     afterEach(function () {
       appGetMock.restore();
-      App.ajax.send.restore();
     });
 
     cases.forEach(function (item) {
@@ -2069,6 +2025,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
           controller.runPreUpgradeCheckOnly({
             type: item.type
           });
+          this.ajaxCalls = testHelpers.filterAjaxRequests('name', 'admin.upgrade.pre_upgrade_check');
         });
 
         it('ROLLING properties', function () {
@@ -2080,7 +2037,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
         });
 
         it(item.ajaxCallCount + ' requests sent', function () {
-          expect(App.ajax.send.callCount).to.equal(item.ajaxCallCount);
+          expect(this.ajaxCalls.length).to.be.equal(item.ajaxCallCount);
         });
 
         it('runningCheckRequests length is ' + item.runningCheckRequestsLength, function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/alert_definitions_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alert_definitions_controller_test.js b/ambari-web/test/controllers/main/alert_definitions_controller_test.js
index 45bbd50..a1f2b9a 100644
--- a/ambari-web/test/controllers/main/alert_definitions_controller_test.js
+++ b/ambari-web/test/controllers/main/alert_definitions_controller_test.js
@@ -20,6 +20,7 @@ var App = require('app');
 
 require('controllers/main/alert_definitions_controller');
 require('models/alerts/alert_definition');
+var testHelpers = require('test/helpers');
 
 var controller;
 describe('App.MainAlertDefinitionsController', function() {
@@ -33,7 +34,6 @@ describe('App.MainAlertDefinitionsController', function() {
   describe('#toggleDefinitionState', function() {
 
     beforeEach(function() {
-      sinon.stub(App.ajax, 'send', Em.K);
       controller.reopen({
         content: [
           App.AlertDefinition.createRecord({id: 1, enabled: true})
@@ -41,14 +41,11 @@ describe('App.MainAlertDefinitionsController', function() {
       });
     });
 
-    afterEach(function() {
-      App.ajax.send.restore();
-    });
-
     it('should do ajax-request', function() {
       var alertDefinition = controller.get('content')[0];
       controller.toggleDefinitionState(alertDefinition);
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'alerts.update_alert_definition');
+      expect(args).to.exists;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/alerts/add_alert_definition/add_alert_definition_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/add_alert_definition/add_alert_definition_controller_test.js b/ambari-web/test/controllers/main/alerts/add_alert_definition/add_alert_definition_controller_test.js
index 05ab913..bcde3c7 100644
--- a/ambari-web/test/controllers/main/alerts/add_alert_definition/add_alert_definition_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/add_alert_definition/add_alert_definition_controller_test.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 require('controllers/main/alerts/add_alert_definition/add_alert_definition_controller');
-
+var testHelpers = require('test/helpers');
 var controller;
 
 describe('App.AddAlertDefinitionController', function () {
@@ -28,22 +28,12 @@ describe('App.AddAlertDefinitionController', function () {
   });
 
   describe("#createNewAlertDefinition()", function () {
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it("valid request is sent", function () {
       controller.createNewAlertDefinition('data');
-      expect(App.ajax.send.getCall(0).args[0]).to.eql({
-        name: 'alerts.create_alert_definition',
-        sender: controller,
-        data: {
-          data: 'data'
-        }
-      });
+      var args = testHelpers.findAjaxRequest('name', 'alerts.create_alert_definition');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({data: 'data'});
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/alerts/alert_instances_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/alert_instances_controller_test.js b/ambari-web/test/controllers/main/alerts/alert_instances_controller_test.js
index 051202d..94653c7 100644
--- a/ambari-web/test/controllers/main/alerts/alert_instances_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/alert_instances_controller_test.js
@@ -17,6 +17,7 @@
  */
 
 var App = require('app');
+var testHelpers = require('test/helpers');
 
 var controller;
 
@@ -26,22 +27,18 @@ describe('App.MainAlertInstancesController', function () {
     controller = App.MainAlertInstancesController.create({});
   });
 
+  afterEach(function () {
+    clearTimeout(controller.get('updateTimer'));
+  });
+
   describe('#fetchAlertInstances', function () {
 
     describe('loading instances from correct endpoint', function () {
 
-      beforeEach(function () {
-        sinon.stub(App.ajax, 'send', Em.K);
-      });
-
-      afterEach(function () {
-        App.ajax.send.restore();
-      });
-
       it('should load by Host name', function () {
 
         controller.loadAlertInstancesByHost('host');
-        var callArgs = App.ajax.send.args[0][0];
+        var callArgs = testHelpers.findAjaxRequest('name', 'alerts.instances.by_host')[0];
         expect(callArgs.name).to.equal('alerts.instances.by_host');
         expect(callArgs.data.hostName).to.equal('host');
 
@@ -50,16 +47,16 @@ describe('App.MainAlertInstancesController', function () {
       it('should load by AlertDefinition id', function () {
 
         controller.loadAlertInstancesByAlertDefinition('1');
-        var callArgs = App.ajax.send.args[0][0];
+        var callArgs = testHelpers.findAjaxRequest('name', 'alerts.instances.by_definition')[0];
         expect(callArgs.name).to.equal('alerts.instances.by_definition');
         expect(callArgs.data.definitionId).to.equal('1');
 
       });
 
       it('should load all', function () {
-
         controller.loadAlertInstances();
-        expect(App.ajax.send.args[0][0].name).to.equal('alerts.instances');
+        var callArgs = testHelpers.findAjaxRequest('name', 'alerts.instances')[0];
+        expect(callArgs).to.exists;
 
       });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 f2f77aa..8cf61f2 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
@@ -17,7 +17,7 @@
  */
 
 var App = require('app');
-
+var testHelpers = require('test/helpers');
 var controller;
 
 function getController() {
@@ -362,7 +362,6 @@ describe('App.MainAlertDefinitionConfigsController', function () {
   describe('#saveConfigs()', function () {
 
     beforeEach(function () {
-      sinon.spy(App.ajax, 'send');
       controller.set('configs', [
         Em.Object.create({isDisabled: true}),
         Em.Object.create({isDisabled: true}),
@@ -372,10 +371,6 @@ describe('App.MainAlertDefinitionConfigsController', function () {
       controller.saveConfigs();
     });
 
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should set isDisabled for each config', function () {
       expect(controller.get('configs').someProperty('isDisabled', false)).to.be.false;
     });
@@ -383,7 +378,8 @@ describe('App.MainAlertDefinitionConfigsController', function () {
       expect(controller.get('canEdit')).to.be.false;
     });
     it('should sent 1 request', function () {
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'alerts.update_alert_definition');
+      expect(args[0]).to.exists;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
index 28e1829..3b024f7 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
@@ -81,27 +81,6 @@ describe('App.MainAlertDefinitionDetailsController', function () {
 
   });
 
-  describe('#toggleDefinitionState()', function () {
-    beforeEach(function() {
-      sinon.stub(App.ajax, 'send', Em.K);
-      controller.reopen({
-        content: [
-          App.AlertDefinition.createRecord({id: 1, enabled: true})
-        ]
-      });
-    });
-
-    afterEach(function() {
-      App.ajax.send.restore();
-    });
-
-    it('should call App.ajax.send function', function () {
-      var alertDefinition = controller.get('content')[0];
-      controller.toggleDefinitionState(alertDefinition);
-      expect(App.ajax.send.calledOnce).to.be.true;
-    });
-  });
-
   describe("#deleteAlertDefinition()", function () {
     beforeEach(function () {
       sinon.stub(App.get('router'), 'transitionTo', Em.K);
@@ -116,24 +95,12 @@ describe('App.MainAlertDefinitionDetailsController', function () {
   });
 
   describe("#loadAlertInstancesHistory()", function () {
-
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
-    it("should load alert instances history", function () {
-
+    it("should set lastDayAlertsCount = null", function () {
       controller.set('lastDayAlertsCount', 'test');
-
       controller.loadAlertInstancesHistory();
-
-      expect(App.ajax.send.calledOnce).to.be.true;
       expect(controller.get('lastDayAlertsCount')).to.equal(null);
     });
+
   });
 
   describe("#loadAlertInstancesHistorySuccess()", function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/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 9352116..84caec6 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
@@ -30,11 +30,6 @@ describe('App.ManageAlertNotificationsController', function () {
 
   beforeEach(function () {
     controller = getController();
-    sinon.stub($, 'ajax', Em.K);
-  });
-
-  afterEach(function () {
-    $.ajax.restore();
   });
 
   describe('#alertNotifications', function () {
@@ -795,8 +790,8 @@ describe('App.ManageAlertNotificationsController', function () {
     it("should send ajax request", function () {
 
       controller.createAlertNotification();
-      expect($.ajax.calledOnce).to.be.true;
-      expect($.ajax.args[0][0].url.contains('overwrite_existing=true')).to.be.false;
+      var args = helpers.findAjaxRequest('name', 'alerts.create_alert_notification');
+      expect(args[0]).to.exists;
     });
 
   });
@@ -831,7 +826,8 @@ describe('App.ManageAlertNotificationsController', function () {
     it("should send ajax request", function () {
 
       controller.updateAlertNotification();
-      expect($.ajax.calledOnce).to.be.true;
+      var args = helpers.findAjaxRequest('name', 'alerts.update_alert_notification');
+      expect(args[0]).to.exists;
     });
 
   });
@@ -877,7 +873,8 @@ describe('App.ManageAlertNotificationsController', function () {
 
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
       popup.onPrimary();
-      expect($.ajax.calledOnce).to.be.true;
+      var args = helpers.findAjaxRequest('name', 'alerts.delete_alert_notification');
+      expect(args[0]).to.exists;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/charts/heatmap_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_test.js b/ambari-web/test/controllers/main/charts/heatmap_test.js
index c3e70e8..a8ece22 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_test.js
@@ -21,6 +21,7 @@ var App = require('app');
 var controller;
 require('models/rack');
 require('controllers/main/charts/heatmap');
+var testHelpers = require('test/helpers');
 
 function getController() {
   return App.MainChartsHeatmapController.create();
@@ -65,13 +66,6 @@ describe('MainChartsHeatmapController', function () {
 
   describe('#showHeatMapMetric()', function () {
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', function () {
-        return {
-          done: function (callback) {
-            callback();
-          }
-        }
-      });
       controller.setProperties({
         activeWidgetLayout: Em.Object.create({
           displayName: 'widget',
@@ -83,13 +77,10 @@ describe('MainChartsHeatmapController', function () {
       });
     });
 
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('should call App.ajax', function () {
       controller.showHeatMapMetric({context:{id: 2}});
-      expect(App.ajax.send.called).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'widget.layout.edit');
+      expect(args).to.exists;
     });
   });
 
@@ -248,55 +239,35 @@ describe('MainChartsHeatmapController', function () {
 
   describe("#getAllHeatMaps()", function() {
 
-    beforeEach(function() {
-      sinon.stub(App.ajax, 'send');
-    });
-
-    afterEach(function() {
-      App.ajax.send.restore();
-    });
-
     it("should call App.ajax.send", function() {
       controller.reopen({
         loadHeatmapsUrlParams: 'url',
         sectionName: 's1'
       });
       controller.getAllHeatMaps();
-      expect(App.ajax.send.calledWith({
-        name: 'widgets.get',
-        sender: controller,
-        data: {
-          urlParams: 'url',
-          sectionName: 's1'
-        }
-      })).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'widgets.get');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: 'url',
+        sectionName: 's1'
+      });
     });
   });
 
   describe("#loadRacks()", function() {
 
-    beforeEach(function() {
-      sinon.stub(App.ajax, 'send');
-    });
-
-    afterEach(function() {
-      App.ajax.send.restore();
-    });
-
     it("should call App.ajax.send", function() {
       controller.reopen({
         loadRacksUrlParams: 'url'
       });
       controller.loadRacks();
-      expect(App.ajax.send.calledWith({
-        name: 'hosts.heatmaps',
-        sender: controller,
-        data: {
-          urlParams: 'url'
-        },
-        success: 'loadRacksSuccessCallback'
-      })).to.be.true;
-
+      var args = testHelpers.findAjaxRequest('name', 'hosts.heatmaps');
+      expect(args[0]).to.exists;
+      expect(args[0].sender).to.be.eql(controller);
+      expect(args[0].data).to.be.eql({
+        urlParams: 'url'
+      });
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js b/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
index 7467bca..db3d10f 100644
--- a/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
+++ b/ambari-web/test/controllers/main/dashboard/config_history_controller_test.js
@@ -18,12 +18,21 @@
 
 
 var App = require('app');
-
+var testHelpers = require('test/helpers');
 require('controllers/main/dashboard/config_history_controller');
 
 describe('MainConfigHistoryController', function () {
 
-  var controller = App.MainConfigHistoryController.create();
+  var controller;
+
+  beforeEach(function () {
+    controller = App.MainConfigHistoryController.create();
+  });
+
+  afterEach(function () {
+    clearTimeout(controller.get('timeoutRef'));
+    controller.destroy();
+  });
 
   describe('#realUrl', function () {
     it('cluster name is empty', function () {
@@ -85,16 +94,12 @@ describe('MainConfigHistoryController', function () {
   describe('#updateTotalCounter()', function () {
 
     beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
       controller.updateTotalCounter();
     });
 
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('ajax-request is sent', function () {
-      expect(App.ajax.send.calledOnce).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'service.serviceConfigVersions.get.total');
+      expect(args).to.exists;
     });
   });
 
@@ -113,14 +118,9 @@ describe('MainConfigHistoryController', function () {
           }
         }
       });
-      sinon.stub(App, 'get', function(k) {
-        if ('testMode' === k) return false;
-        return Em.get(App, k);
-      });
     });
     afterEach(function () {
       App.router.get.restore();
-      App.get.restore();
     });
     it('query params is empty', function () {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ddf479ef/ambari-web/test/controllers/main/host/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/add_controller_test.js b/ambari-web/test/controllers/main/host/add_controller_test.js
index 6dcb2c9..ed8e78b 100644
--- a/ambari-web/test/controllers/main/host/add_controller_test.js
+++ b/ambari-web/test/controllers/main/host/add_controller_test.js
@@ -23,6 +23,7 @@ require('controllers/main/host/add_controller');
 require('models/host_component');
 require('models/service');
 require('mappers/server_data_mapper');
+var testHelpers = require('test/helpers');
 
 describe('App.AddHostController', function () {
 
@@ -302,30 +303,26 @@ describe('App.AddHostController', function () {
 
   describe('#installServices()', function () {
 
-    beforeEach(function () {
-      sinon.spy(App.ajax, "send");
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
-
     it('No hosts', function () {
       controller.set('content.cluster', {name: 'cl'});
       controller.set('testDBHosts', {});
       expect(controller.installServices()).to.be.false;
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.host_components.update');
+      expect(args).to.not.exists;
     });
     it('Cluster name is empty', function () {
       controller.set('content.cluster', {name: ''});
       controller.set('testDBHosts', {'host1': {}});
       expect(controller.installServices()).to.be.false;
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'common.host_components.update');
+      expect(args).to.not.exists;
     });
     it('Cluster name is correct and hosts are present', function () {
       controller.set('content.cluster', {name: 'cl'});
       controller.set('testDBHosts', {'host1': {isInstalled: false}});
       expect(controller.installServices()).to.be.true;
-      expect(App.ajax.send.called).to.be.true;
+      var args = testHelpers.findAjaxRequest('name', 'common.host_components.update');
+      expect(args).to.exists;
     });
   });
 
@@ -412,7 +409,7 @@ describe('App.AddHostController', function () {
     });
   });
 
-  describe("#loadServices", function () {
+  /*describe("#loadServices", function () {
     var services = {
       db: null,
       stack: [],
@@ -590,7 +587,7 @@ describe('App.AddHostController', function () {
     });
 
   });
-
+*/
   describe("#loadSlaveComponentHosts()", function () {
 
     var mock = {
@@ -746,16 +743,12 @@ describe('App.AddHostController', function () {
   });
 
   describe("#applyConfigGroup()", function () {
-    beforeEach(function () {
-      sinon.stub(App.ajax, 'send', Em.K);
-    });
-    afterEach(function () {
-      App.ajax.send.restore();
-    });
+
     it("No config groups", function () {
       controller.set('content.configGroups', []);
       controller.applyConfigGroup();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'config_groups.update_config_group');
+      expect(args).to.not.exists;
     });
     it("selectedConfigGroup absent", function () {
       controller.set('content.configGroups', [
@@ -765,7 +758,8 @@ describe('App.AddHostController', function () {
         }
       ]);
       controller.applyConfigGroup();
-      expect(App.ajax.send.called).to.be.false;
+      var args = testHelpers.findAjaxRequest('name', 'config_groups.update_config_group');
+      expect(args).to.not.exists;
     });
     it("selectedConfigGroup present", function () {
       controller.set('content.configGroups', [
@@ -784,9 +778,9 @@ describe('App.AddHostController', function () {
         }
       ]);
       controller.applyConfigGroup();
-
-      expect(App.ajax.send.getCall(0).args[0].name).to.equal('config_groups.update_config_group');
-      expect(App.ajax.send.getCall(0).args[0].data).to.eql({
+      var args = testHelpers.findAjaxRequest('name', 'config_groups.update_config_group');
+      expect(args[0]).to.exists;
+      expect(args[0].data).to.be.eql({
         "id": 1,
         "configGroup": {
           "ConfigGroup": {
@@ -1362,7 +1356,6 @@ describe('App.AddHostController', function () {
     beforeEach(function () {
       sinon.stub(controller, 'clearAllSteps', Em.K);
       sinon.stub(controller, 'clearStorageData', Em.K);
-      sinon.stub(App.updater, 'immediateRun', Em.K);
       sinon.stub(App.router, 'get').returns(mock);
       sinon.spy(mock, 'updateAll');
       sinon.spy(mock, 'getAllHostNames');
@@ -1371,7 +1364,6 @@ describe('App.AddHostController', function () {
     afterEach(function () {
       controller.clearAllSteps.restore();
       controller.clearStorageData.restore();
-      App.updater.immediateRun.restore();
       App.router.get.restore();
       mock.updateAll.restore();
       mock.getAllHostNames.restore();


Mime
View raw message