mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
commit
d698887c0e
@ -4,13 +4,13 @@ import adhocModule from 'adhoc/main';
|
||||
import RestStub from '../support/rest-stub';
|
||||
|
||||
describe("adhoc.controller", function() {
|
||||
var $scope, $rootScope, $location, $routeParams,
|
||||
var $scope, $rootScope, $location, $stateParams, $stateExtender,
|
||||
CheckPasswords, PromptForPasswords, CreateLaunchDialog, AdhocForm,
|
||||
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
|
||||
KindChange, LookUpInit, CredentialList, Empty, Wait;
|
||||
|
||||
var $controller, ctrl, generateFormCallback, waitCallback, locationCallback,
|
||||
getBasePath, processErrorsCallback, restCallback;
|
||||
getBasePath, processErrorsCallback, restCallback, stateExtenderCallback;
|
||||
|
||||
beforeEach("instantiate the adhoc module", function() {
|
||||
angular.mock.module(adhocModule.name);
|
||||
@ -29,6 +29,9 @@ describe("adhoc.controller", function() {
|
||||
};
|
||||
processErrorsCallback = sinon.spy();
|
||||
restCallback = new RestStub();
|
||||
stateExtenderCallback = {
|
||||
addState: angular.noop
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) {
|
||||
@ -50,6 +53,8 @@ describe("adhoc.controller", function() {
|
||||
$provide.value('CredentialList', angular.noop);
|
||||
$provide.value('Empty', angular.noop);
|
||||
$provide.value('Wait', waitCallback);
|
||||
$provide.value('$stateExtender', stateExtenderCallback);
|
||||
$provide.value('$stateParams', angular.noop);
|
||||
}]));
|
||||
|
||||
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() {
|
||||
it("should initially provide a canned argument help response", function() {
|
||||
expect($scope.argsPopOver).to.equal('<p>These arguments are used ' +
|
||||
|
||||
@ -24,5 +24,6 @@
|
||||
require('./setup/lodash');
|
||||
require('./setup/local-storage');
|
||||
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');
|
||||
Loading…
x
Reference in New Issue
Block a user