Skip to content
Snippets Groups Projects
Commit 8c87e666 authored by felmer's avatar felmer
Browse files

SSDM-5723: Adding tests for searching, creating and getting AuthorizationGroups.

SVN: 38855
parent ad8d0b38
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -29,6 +29,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.AttachmentCreation = dtos.AttachmentCreation; this.AttachmentCreation = dtos.AttachmentCreation;
this.VocabularyTermCreation = dtos.VocabularyTermCreation; this.VocabularyTermCreation = dtos.VocabularyTermCreation;
this.TagCreation = dtos.TagCreation; this.TagCreation = dtos.TagCreation;
this.AuthorizationGroupCreation = dtos.AuthorizationGroupCreation;
this.SemanticAnnotationCreation = dtos.SemanticAnnotationCreation; this.SemanticAnnotationCreation = dtos.SemanticAnnotationCreation;
this.DataSetCreation = dtos.DataSetCreation; this.DataSetCreation = dtos.DataSetCreation;
this.FullDataSetCreation = dtos.FullDataSetCreation; this.FullDataSetCreation = dtos.FullDataSetCreation;
...@@ -61,6 +62,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -61,6 +62,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.ExternalDmsDeletionOptions = dtos.ExternalDmsDeletionOptions; this.ExternalDmsDeletionOptions = dtos.ExternalDmsDeletionOptions;
this.TagDeletionOptions = dtos.TagDeletionOptions; this.TagDeletionOptions = dtos.TagDeletionOptions;
this.SemanticAnnotationDeletionOptions = dtos.SemanticAnnotationDeletionOptions; this.SemanticAnnotationDeletionOptions = dtos.SemanticAnnotationDeletionOptions;
this.PersonPermId = dtos.PersonPermId;
this.EntityTypePermId = dtos.EntityTypePermId; this.EntityTypePermId = dtos.EntityTypePermId;
this.SpacePermId = dtos.SpacePermId; this.SpacePermId = dtos.SpacePermId;
this.ProjectPermId = dtos.ProjectPermId; this.ProjectPermId = dtos.ProjectPermId;
...@@ -93,6 +95,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -93,6 +95,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.VocabularyTermSearchCriteria = dtos.VocabularyTermSearchCriteria; this.VocabularyTermSearchCriteria = dtos.VocabularyTermSearchCriteria;
this.DataSetFileSearchCriteria = dtos.DataSetFileSearchCriteria; this.DataSetFileSearchCriteria = dtos.DataSetFileSearchCriteria;
this.TagSearchCriteria = dtos.TagSearchCriteria; this.TagSearchCriteria = dtos.TagSearchCriteria;
this.AuthorizationGroupSearchCriteria = dtos.AuthorizationGroupSearchCriteria;
this.DataStoreSearchCriteria = dtos.DataStoreSearchCriteria; this.DataStoreSearchCriteria = dtos.DataStoreSearchCriteria;
this.PropertyTypeSearchCriteria = dtos.PropertyTypeSearchCriteria; this.PropertyTypeSearchCriteria = dtos.PropertyTypeSearchCriteria;
this.PropertyAssignmentSearchCriteria = dtos.PropertyAssignmentSearchCriteria; this.PropertyAssignmentSearchCriteria = dtos.PropertyAssignmentSearchCriteria;
...@@ -110,6 +113,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -110,6 +113,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.ExternalDmsFetchOptions = dtos.ExternalDmsFetchOptions; this.ExternalDmsFetchOptions = dtos.ExternalDmsFetchOptions;
this.VocabularyTermFetchOptions = dtos.VocabularyTermFetchOptions; this.VocabularyTermFetchOptions = dtos.VocabularyTermFetchOptions;
this.TagFetchOptions = dtos.TagFetchOptions; this.TagFetchOptions = dtos.TagFetchOptions;
this.AuthorizationGroupFetchOptions = dtos.AuthorizationGroupFetchOptions;
this.PropertyTypeFetchOptions = dtos.PropertyTypeFetchOptions; this.PropertyTypeFetchOptions = dtos.PropertyTypeFetchOptions;
this.PropertyAssignmentFetchOptions = dtos.PropertyAssignmentFetchOptions; this.PropertyAssignmentFetchOptions = dtos.PropertyAssignmentFetchOptions;
this.SemanticAnnotationFetchOptions = dtos.SemanticAnnotationFetchOptions; this.SemanticAnnotationFetchOptions = dtos.SemanticAnnotationFetchOptions;
...@@ -146,6 +150,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -146,6 +150,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.GetMaterialsOperation = dtos.GetMaterialsOperation; this.GetMaterialsOperation = dtos.GetMaterialsOperation;
this.GetVocabularyTermsOperation = dtos.GetVocabularyTermsOperation; this.GetVocabularyTermsOperation = dtos.GetVocabularyTermsOperation;
this.GetTagsOperation = dtos.GetTagsOperation; this.GetTagsOperation = dtos.GetTagsOperation;
this.GetAuthorizationGroupsOperation = dtos.GetAuthorizationGroupsOperation;
this.GetExternalDmsOperation = dtos.GetExternalDmsOperation; this.GetExternalDmsOperation = dtos.GetExternalDmsOperation;
this.GetSemanticAnnotationsOperation = dtos.GetSemanticAnnotationsOperation; this.GetSemanticAnnotationsOperation = dtos.GetSemanticAnnotationsOperation;
...@@ -161,6 +166,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -161,6 +166,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.CreateMaterialTypesOperation = dtos.CreateMaterialTypesOperation; this.CreateMaterialTypesOperation = dtos.CreateMaterialTypesOperation;
this.CreateVocabularyTermsOperation = dtos.CreateVocabularyTermsOperation; this.CreateVocabularyTermsOperation = dtos.CreateVocabularyTermsOperation;
this.CreateTagsOperation = dtos.CreateTagsOperation; this.CreateTagsOperation = dtos.CreateTagsOperation;
this.CreateAuthorizationGroupsOperation = dtos.CreateAuthorizationGroupsOperation;
this.CreateSemanticAnnotationsOperation = dtos.CreateSemanticAnnotationsOperation; this.CreateSemanticAnnotationsOperation = dtos.CreateSemanticAnnotationsOperation;
this.CreateExternalDmsOperation = dtos.CreateExternalDmsOperation; this.CreateExternalDmsOperation = dtos.CreateExternalDmsOperation;
...@@ -200,6 +206,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -200,6 +206,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.SearchVocabularyTermsOperation = dtos.SearchVocabularyTermsOperation; this.SearchVocabularyTermsOperation = dtos.SearchVocabularyTermsOperation;
this.SearchExternalDmsOperation = dtos.SearchExternalDmsOperation; this.SearchExternalDmsOperation = dtos.SearchExternalDmsOperation;
this.SearchTagsOperation = dtos.SearchTagsOperation; this.SearchTagsOperation = dtos.SearchTagsOperation;
this.SearchAuthorizationGroupsOperation = dtos.SearchAuthorizationGroupsOperation;
this.SearchCustomASServicesOperation = dtos.SearchCustomASServicesOperation; this.SearchCustomASServicesOperation = dtos.SearchCustomASServicesOperation;
this.SearchObjectKindModificationsOperation = dtos.SearchObjectKindModificationsOperation; this.SearchObjectKindModificationsOperation = dtos.SearchObjectKindModificationsOperation;
this.SearchGloballyOperation = dtos.SearchGloballyOperation; this.SearchGloballyOperation = dtos.SearchGloballyOperation;
...@@ -392,6 +399,16 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -392,6 +399,16 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
}); });
}.bind(this); }.bind(this);
this.createAuthorizationGroup = function(facade) {
var c = this;
var creation = new dtos.AuthorizationGroupCreation();
creation.setCode(c.generateId("AUTHORIZATION_GROUP"));
creation.setUsers([new c.PersonPermId("power_user")]);
return facade.createAuthorizationGroups([ creation ]).then(function(permIds) {
return permIds[0];
});
}.bind(this);
this.createSemanticAnnotation = function(facade) { this.createSemanticAnnotation = function(facade) {
var c = this; var c = this;
var creation = new dtos.SemanticAnnotationCreation(); var creation = new dtos.SemanticAnnotationCreation();
...@@ -790,6 +807,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -790,6 +807,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
return fo; return fo;
}; };
this.createAuthorizationGroupFetchOptions = function() {
var fo = new dtos.AuthorizationGroupFetchOptions();
fo.withRegistrator();
fo.withUsers();
return fo;
};
this.createPropertyTypeFetchOptions = function() { this.createPropertyTypeFetchOptions = function() {
var fo = new dtos.PropertyTypeFetchOptions(); var fo = new dtos.PropertyTypeFetchOptions();
fo.withVocabulary(); fo.withVocabulary();
......
...@@ -87,6 +87,19 @@ var sources = [ ...@@ -87,6 +87,19 @@ var sources = [
'as/dto/attachment/id/AttachmentFileName', 'as/dto/attachment/id/AttachmentFileName',
'as/dto/attachment/update/AttachmentListUpdateValue', 'as/dto/attachment/update/AttachmentListUpdateValue',
'as/dto/authorizationgroup/create/AuthorizationGroupCreation',
'as/dto/authorizationgroup/create/CreateAuthorizationGroupsOperation',
'as/dto/authorizationgroup/create/CreateAuthorizationGroupsOperationResult',
'as/dto/authorizationgroup/fetchoptions/AuthorizationGroupFetchOptions',
'as/dto/authorizationgroup/fetchoptions/AuthorizationGroupSortOptions',
'as/dto/authorizationgroup/get/GetAuthorizationGroupsOperation',
'as/dto/authorizationgroup/get/GetAuthorizationGroupsOperationResult',
'as/dto/authorizationgroup/id/AuthorizationGroupPermId',
'as/dto/authorizationgroup/search/AuthorizationGroupSearchCriteria',
'as/dto/authorizationgroup/search/SearchAuthorizationGroupsOperation',
'as/dto/authorizationgroup/search/SearchAuthorizationGroupsOperationResult',
'as/dto/authorizationgroup/AuthorizationGroup',
'as/dto/common/Enum', 'as/dto/common/Enum',
'as/dto/common/fetchoptions/EmptyFetchOptions', 'as/dto/common/fetchoptions/EmptyFetchOptions',
'as/dto/common/fetchoptions/EntitySortOptions', 'as/dto/common/fetchoptions/EntitySortOptions',
......
...@@ -137,6 +137,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) { ...@@ -137,6 +137,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeCreateOperation(new c.CreateTagsOperation(creations)); return this._executeCreateOperation(new c.CreateTagsOperation(creations));
} }
this.createAuthorizationGroups = function(creations) {
return this._executeCreateOperation(new c.CreateAuthorizationGroupsOperation(creations));
}
this.createSemanticAnnotations = function(creations) { this.createSemanticAnnotations = function(creations) {
return this._executeCreateOperation(new c.CreateSemanticAnnotationsOperation(creations)); return this._executeCreateOperation(new c.CreateSemanticAnnotationsOperation(creations));
} }
...@@ -217,6 +221,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) { ...@@ -217,6 +221,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeGetOperation(new c.GetTagsOperation(ids, fetchOptions)); return this._executeGetOperation(new c.GetTagsOperation(ids, fetchOptions));
} }
this.getAuthorizationGroups = function(ids, fetchOptions) {
return this._executeGetOperation(new c.GetAuthorizationGroupsOperation(ids, fetchOptions));
}
this.getSemanticAnnotations = function(ids, fetchOptions) { this.getSemanticAnnotations = function(ids, fetchOptions) {
return this._executeGetOperation(new c.GetSemanticAnnotationsOperation(ids, fetchOptions)); return this._executeGetOperation(new c.GetSemanticAnnotationsOperation(ids, fetchOptions));
} }
...@@ -281,6 +289,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) { ...@@ -281,6 +289,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeSearchOperation(new c.SearchTagsOperation(criteria, fetchOptions)); return this._executeSearchOperation(new c.SearchTagsOperation(criteria, fetchOptions));
} }
this.searchAuthorizationGroups = function(criteria, fetchOptions) {
return this._executeSearchOperation(new c.SearchAuthorizationGroupsOperation(criteria, fetchOptions));
}
this.searchCustomASServices = function(criteria, fetchOptions) { this.searchCustomASServices = function(criteria, fetchOptions) {
return this._executeSearchOperation(new c.SearchCustomASServicesOperation(criteria, fetchOptions)); return this._executeSearchOperation(new c.SearchCustomASServicesOperation(criteria, fetchOptions));
} }
......
...@@ -344,6 +344,30 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' ...@@ -344,6 +344,30 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
testGet(c, fCreate, fGet, fGetEmptyFetchOptions, fechOptionsTestConfig); testGet(c, fCreate, fGet, fGetEmptyFetchOptions, fechOptionsTestConfig);
}); });
QUnit.test("getAuthorizationGroups()", function(assert) {
var c = new common(assert, openbis);
var fo = new c.AuthorizationGroupFetchOptions();
var fechOptionsTestConfig = getConfigForFetchOptions(fo);
fechOptionsTestConfig.SortBy = null;
var fCreate = function(facade) {
return $.when(c.createAuthorizationGroup(facade), c.createAuthorizationGroup(facade)).then(function(permId1, permId2) {
return [ permId1, permId2 ];
});
}
var fGet = function(facade, permIds) {
testFetchOptionsAssignation(c, fo, fechOptionsTestConfig);
return facade.getAuthorizationGroups(permIds, fo);
}
var fGetEmptyFetchOptions = function(facade, permIds) {
return facade.getAuthorizationGroups(permIds, new c.AuthorizationGroupFetchOptions());
}
testGet(c, fCreate, fGet, fGetEmptyFetchOptions, fechOptionsTestConfig);
});
QUnit.test("getOperationExecutions()", function(assert) { QUnit.test("getOperationExecutions()", function(assert) {
var c = new common(assert, openbis); var c = new common(assert, openbis);
var fo = new c.OperationExecutionFetchOptions(); var fo = new c.OperationExecutionFetchOptions();
......
...@@ -1302,6 +1302,31 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' ...@@ -1302,6 +1302,31 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
testSearch(c, fSearch, fCheck); testSearch(c, fSearch, fCheck);
}); });
QUnit.test("searchAuthorizationGroups()", function(assert) {
var c = new common(assert, openbis);
var code;
var fSearch = function(facade) {
return c.createAuthorizationGroup(facade).then(function(permId) {
var criteria = new c.AuthorizationGroupSearchCriteria();
code = permId.getPermId();
criteria.withCode().thatEquals(code);
return facade.searchAuthorizationGroups(criteria, c.createAuthorizationGroupFetchOptions());
});
}
var fCheck = function(facade, groups) {
c.assertEqual(groups.length, 1);
var group = groups[0];
c.assertEqual(group.getCode(), code, "Code");
var users = group.getUsers();
c.assertEqual(users[0].getUserId(), "power_user", "User");
c.assertEqual(users.length, 1, "# Users");
}
testSearch(c, fSearch, fCheck);
});
QUnit.test("searchOperationExecutions()", function(assert) { QUnit.test("searchOperationExecutions()", function(assert) {
var c = new common(assert, openbis); var c = new common(assert, openbis);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment