Merge "Add expectations to identity specs"

This commit is contained in:
Zuul 2020-12-23 05:56:09 +00:00 committed by Gerrit Code Review
commit d9d54b1fff
5 changed files with 29 additions and 14 deletions

View File

@ -141,8 +141,7 @@ module.exports = function (config) {
client: { client: {
jasmine: { jasmine: {
random: false, random: false
failSpecWithNoExpectations: true
} }
}, },

View File

@ -97,12 +97,14 @@
var domain = generateDomains(1)[0]; var domain = generateDomains(1)[0];
service.perform(domain); service.perform(domain);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(domain.id); deleteFunction(domain.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete domain by item action', function(done) { it('should pass and fail in a function that delete domain by item action', function(done) {
@ -113,12 +115,14 @@
var domain = generateDomains(1)[0]; var domain = generateDomains(1)[0];
service.perform(domain); service.perform(domain);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(domain.id); deleteFunction(domain.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete domain by batch action', function(done) { it('should pass and fail in a function that delete domain by batch action', function(done) {
@ -129,12 +133,14 @@
var domain = generateDomains(1)[0]; var domain = generateDomains(1)[0];
service.perform([domain]); service.perform([domain]);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(domain.id); deleteFunction(domain.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('fail to policy check because of no privilege', function() { it('fail to policy check because of no privilege', function() {

View File

@ -109,12 +109,14 @@
var group = generateItems(1)[0]; var group = generateItems(1)[0];
service.perform(group); service.perform(group);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(group.id); deleteFunction(group.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete group by item action', function(done) { it('should pass and fail in a function that delete group by item action', function(done) {
@ -125,12 +127,14 @@
var group = generateItems(1)[0]; var group = generateItems(1)[0];
service.perform(group); service.perform(group);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(group.id); deleteFunction(group.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete group by batch action', function(done) { it('should pass and fail in a function that delete group by batch action', function(done) {
@ -141,12 +145,14 @@
var group = generateItems(1)[0]; var group = generateItems(1)[0];
service.perform([group]); service.perform([group]);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(group.id); deleteFunction(group.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should call policy check', function() { it('should call policy check', function() {

View File

@ -98,12 +98,14 @@
var user = generateItems(1)[0]; var user = generateItems(1)[0];
service.perform(user); service.perform(user);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(user.id); deleteFunction(user.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete user by item action', function(done) { it('should pass and fail in a function that delete user by item action', function(done) {
@ -114,12 +116,14 @@
var user = generateItems(1)[0]; var user = generateItems(1)[0];
service.perform(user); service.perform(user);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(user.id); deleteFunction(user.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should pass and fail in a function that delete user by batch action', function(done) { it('should pass and fail in a function that delete user by batch action', function(done) {
@ -130,12 +134,14 @@
var user = generateItems(1)[0]; var user = generateItems(1)[0];
service.perform([user]); service.perform([user]);
$scope.$apply(); $scope.$apply();
done();
var contextArg = deleteModalService.open.calls.argsFor(0)[2]; var contextArg = deleteModalService.open.calls.argsFor(0)[2];
var deleteFunction = contextArg.deleteEntity; var deleteFunction = contextArg.deleteEntity;
deleteFunction(user.id); deleteFunction(user.id);
expect(deleteModalService.open).toHaveBeenCalled();
done();
}); });
it('should call policy check', function() { it('should call policy check', function() {

View File

@ -180,11 +180,9 @@ module.exports = function (config) {
dir: '../cover/openstack_dashboard' dir: '../cover/openstack_dashboard'
}, },
// TODO(tmazur) set failSpecWithNoExpectations to true after fixing tests
client: { client: {
jasmine: { jasmine: {
random: false, random: false
failSpecWithNoExpectations: false
} }
}, },