mirror of
https://github.com/ansible/awx.git
synced 2026-02-04 02:58:13 -03:30
Fixed unit tests after the ui-router dependency was added. Removed a couple of tests dealing with checking to make sure that the breadcrumb was properly set via the adhoc controller. Since breadcrumbs have been moved out we'll need to write a new suite of tests to address them.
This commit is contained in:
@@ -4,13 +4,13 @@ import adhocModule from 'adhoc/main';
|
|||||||
import RestStub from '../support/rest-stub';
|
import RestStub from '../support/rest-stub';
|
||||||
|
|
||||||
describe("adhoc.controller", function() {
|
describe("adhoc.controller", function() {
|
||||||
var $scope, $rootScope, $location, $routeParams,
|
var $scope, $rootScope, $location, $stateParams, $stateExtender,
|
||||||
CheckPasswords, PromptForPasswords, CreateLaunchDialog, AdhocForm,
|
CheckPasswords, PromptForPasswords, CreateLaunchDialog, AdhocForm,
|
||||||
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
|
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
|
||||||
KindChange, LookUpInit, CredentialList, Empty, Wait;
|
KindChange, LookUpInit, CredentialList, Empty, Wait;
|
||||||
|
|
||||||
var $controller, ctrl, generateFormCallback, waitCallback, locationCallback,
|
var $controller, ctrl, generateFormCallback, waitCallback, locationCallback,
|
||||||
getBasePath, processErrorsCallback, restCallback;
|
getBasePath, processErrorsCallback, restCallback, stateExtenderCallback;
|
||||||
|
|
||||||
beforeEach("instantiate the adhoc module", function() {
|
beforeEach("instantiate the adhoc module", function() {
|
||||||
angular.mock.module(adhocModule.name);
|
angular.mock.module(adhocModule.name);
|
||||||
@@ -29,6 +29,9 @@ describe("adhoc.controller", function() {
|
|||||||
};
|
};
|
||||||
processErrorsCallback = sinon.spy();
|
processErrorsCallback = sinon.spy();
|
||||||
restCallback = new RestStub();
|
restCallback = new RestStub();
|
||||||
|
stateExtenderCallback = {
|
||||||
|
addState: angular.noop
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) {
|
beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) {
|
||||||
@@ -50,6 +53,8 @@ describe("adhoc.controller", function() {
|
|||||||
$provide.value('CredentialList', angular.noop);
|
$provide.value('CredentialList', angular.noop);
|
||||||
$provide.value('Empty', angular.noop);
|
$provide.value('Empty', angular.noop);
|
||||||
$provide.value('Wait', waitCallback);
|
$provide.value('Wait', waitCallback);
|
||||||
|
$provide.value('$stateExtender', stateExtenderCallback);
|
||||||
|
$provide.value('$stateParams', angular.noop);
|
||||||
}]));
|
}]));
|
||||||
|
|
||||||
beforeEach("put $q in scope", window.inject(['$q', function($q) {
|
beforeEach("put $q in scope", window.inject(['$q', function($q) {
|
||||||
@@ -128,34 +133,6 @@ describe("adhoc.controller", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getInventoryNameForBreadcrumbs", function() {
|
|
||||||
it('should set the inventory name on scope', function() {
|
|
||||||
var req = ctrl.privateFn.getInventoryNameForBreadcrumbs("foo");
|
|
||||||
var response = { data: { name: "foo" } };
|
|
||||||
|
|
||||||
restCallback.succeed(response);
|
|
||||||
restCallback.flush();
|
|
||||||
|
|
||||||
return req.then(function() {
|
|
||||||
expect($scope.inv_name).to.equal('foo');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should navigate to the inventory manage page when the inventory ' +
|
|
||||||
'can not be found', function() {
|
|
||||||
var req = ctrl.privateFn.getInventoryNameForBreadcrumbs("foo");
|
|
||||||
var response = { "detail": "Not found", status: "bad" };
|
|
||||||
|
|
||||||
restCallback.fail(response);
|
|
||||||
restCallback.flush();
|
|
||||||
|
|
||||||
return req.catch(function() {
|
|
||||||
expect(processErrorsCallback).to.have.been.called;
|
|
||||||
expect(locationCallback.path).to.have.been.calledWith("/inventories/");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("instantiateArgumentHelp", function() {
|
describe("instantiateArgumentHelp", function() {
|
||||||
it("should initially provide a canned argument help response", function() {
|
it("should initially provide a canned argument help response", function() {
|
||||||
expect($scope.argsPopOver).to.equal('<p>These arguments are used ' +
|
expect($scope.argsPopOver).to.equal('<p>These arguments are used ' +
|
||||||
|
|||||||
@@ -24,5 +24,6 @@
|
|||||||
require('./setup/lodash');
|
require('./setup/lodash');
|
||||||
require('./setup/local-storage');
|
require('./setup/local-storage');
|
||||||
require('./setup/moment');
|
require('./setup/moment');
|
||||||
|
require('./setup/angular-ui-router');
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
1
awx/ui/client/tests/support/node/setup/angular-ui-router.js
vendored
Normal file
1
awx/ui/client/tests/support/node/setup/angular-ui-router.js
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
require('angular-ui-router');
|
||||||
Reference in New Issue
Block a user