dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43922
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22283: added test for users with duplicate usernames, ignored for now
------------------------------------------------------------
revno: 22283
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-14 10:38:48 +0700
message:
added test for users with duplicate usernames, ignored for now
added:
dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/user_duplicate_username.json
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java 2016-03-14 01:56:52 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java 2016-03-14 03:38:48 +0000
@@ -64,6 +64,7 @@
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.validation.ValidationRule;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
@@ -1413,6 +1414,23 @@
assertEquals( "DataElementA", dataElement.getName() );
}
+ @Test
+ @Ignore
+ public void testCreateMetadataWithDuplicateUsername() throws IOException
+ {
+ Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(
+ new ClassPathResource( "dxf2/user_duplicate_username.json" ).getInputStream(), RenderFormat.JSON );
+
+ ObjectBundleParams params = new ObjectBundleParams();
+ params.setObjectBundleMode( ObjectBundleMode.COMMIT );
+ params.setImportMode( ImportStrategy.CREATE_AND_UPDATE );
+ params.setObjects( metadata );
+
+ ObjectBundle bundle = objectBundleService.create( params );
+ objectBundleService.validate( bundle );
+ objectBundleService.commit( bundle );
+ }
+
private void defaultSetup()
{
DataElement de1 = createDataElement( 'A' );
=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/user_duplicate_username.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/user_duplicate_username.json 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/user_duplicate_username.json 2016-03-14 03:38:48 +0000
@@ -0,0 +1,179 @@
+{
+ "userRoles": [
+ {
+ "dataSets": [ ],
+ "publicAccess": "--------",
+ "name": "Superuser",
+ "programs": [ ],
+ "lastUpdated": "2016-03-12T06:18:41.386+0000",
+ "created": "2016-03-12T06:18:41.386+0000",
+ "userGroupAccesses": [ ],
+ "authorities": [
+ "F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS",
+ "ALL",
+ "F_USERGROUP_MANAGING_RELATIONSHIPS_ADD",
+ "F_REPORTTABLE_PUBLIC_ADD",
+ "F_TRACKED_ENTITY_INSTANCE_DELETE",
+ "F_USER_GROUPS_READ_ONLY_ADD_MEMBERS",
+ "F_MAP_PUBLIC_ADD",
+ "F_USER_ADD_WITHIN_MANAGED_GROUP",
+ "F_TRACKED_ENTITY_INSTANCE_SEARCH",
+ "F_PROGRAM_ENROLLMENT",
+ "F_REPORTTABLE_EXTERNAL",
+ "F_SQLVIEW_EXTERNAL",
+ "F_GIS_ADMIN",
+ "F_REPLICATE_USER",
+ "F_INSERT_CUSTOM_JS_CSS",
+ "F_DASHBOARD_PUBLIC_ADD",
+ "F_METADATA_IMPORT",
+ "F_CHART_PUBLIC_ADD",
+ "F_VIEW_UNAPPROVED_DATA",
+ "F_CHART_EXTERNAL",
+ "F_USERGROUP_MANAGING_RELATIONSHIPS_VIEW",
+ "F_METADATA_EXPORT",
+ "F_PROGRAM_UNENROLLMENT",
+ "F_APPROVE_DATA",
+ "F_ACCEPT_DATA_LOWER_LEVELS",
+ "F_TRACKED_ENTITY_INSTANCE_ADD",
+ "F_USERGROUP_PUBLIC_ADD",
+ "F_OAUTH2_CLIENT_MANAGE",
+ "F_TRACKED_ENTITY_DATAVALUE_ADD",
+ "F_PROGRAM_DASHBOARD_CONFIG_ADMIN",
+ "F_MAP_EXTERNAL",
+ "F_APPROVE_DATA_LOWER_LEVELS",
+ "F_TRACKED_ENTITY_DATAVALUE_DELETE"
+ ],
+ "id": "tHEWGwIMsJk"
+ }
+ ],
+ "users": [
+ {
+ "email": "user@xxxxx",
+ "surname": "BB",
+ "firstName": "User",
+ "created": "2016-03-12T06:21:02.324+0000",
+ "lastUpdated": "2016-03-12T06:21:02.325+0000",
+ "dataViewOrganisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "organisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "userCredentials": {
+ "user": {
+ "id": "enHApD3I6Ho"
+ },
+ "cogsDimensionConstraints": [ ],
+ "selfRegistered": false,
+ "catDimensionConstraints": [ ],
+ "lastLogin": "2016-03-12T06:21:02.226+0000",
+ "created": "2016-03-12T06:21:02.329+0000",
+ "passwordLastUpdated": "2016-03-12T06:21:02.226+0000",
+ "userInfo": {
+ "id": "MwhEJUnTHkn"
+ },
+ "userRoles": [
+ {
+ "id": "tHEWGwIMsJk"
+ }
+ ],
+ "username": "admin",
+ "invitation": false,
+ "disabled": false,
+ "externalAuth": false
+ },
+ "teiSearchOrganisationUnits": [ ],
+ "id": "MwhEJUnTHkn",
+ "attributeValues": [ ]
+ },
+ {
+ "firstName": "User",
+ "email": "user@xxxxx",
+ "surname": "AA",
+ "attributeValues": [ ],
+ "id": "sPWjoHSY03y",
+ "created": "2016-03-12T06:20:43.502+0000",
+ "lastUpdated": "2016-03-12T06:20:43.502+0000",
+ "dataViewOrganisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "organisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "userCredentials": {
+ "username": "admin",
+ "userRoles": [
+ {
+ "id": "tHEWGwIMsJk"
+ }
+ ],
+ "invitation": false,
+ "disabled": false,
+ "externalAuth": false,
+ "cogsDimensionConstraints": [ ],
+ "user": {
+ "id": "enHApD3I6Ho"
+ },
+ "selfRegistered": false,
+ "catDimensionConstraints": [ ],
+ "lastLogin": "2016-03-12T06:20:43.407+0000",
+ "created": "2016-03-12T06:20:43.508+0000",
+ "userInfo": {
+ "id": "sPWjoHSY03y"
+ },
+ "passwordLastUpdated": "2016-03-12T06:20:43.407+0000"
+ },
+ "teiSearchOrganisationUnits": [ ]
+ },
+ {
+ "surname": "admin",
+ "firstName": "admin",
+ "organisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "dataViewOrganisationUnits": [
+ {
+ "id": "inVD5SdytkT"
+ }
+ ],
+ "userCredentials": {
+ "externalAuth": false,
+ "disabled": false,
+ "invitation": false,
+ "userRoles": [
+ {
+ "id": "tHEWGwIMsJk"
+ }
+ ],
+ "username": "admin",
+ "passwordLastUpdated": "2016-03-12T06:18:41.403+0000",
+ "userInfo": {
+ "id": "enHApD3I6Ho"
+ },
+ "created": "2016-03-12T06:18:41.505+0000",
+ "lastLogin": "2016-03-12T06:18:41.401+0000",
+ "catDimensionConstraints": [ ],
+ "selfRegistered": false,
+ "user": {
+ "id": "enHApD3I6Ho"
+ },
+ "cogsDimensionConstraints": [ ]
+ },
+ "lastUpdated": "2016-03-12T06:20:18.336+0000",
+ "created": "2016-03-12T06:18:41.374+0000",
+ "teiSearchOrganisationUnits": [ ],
+ "id": "enHApD3I6Ho",
+ "attributeValues": [ ]
+ }
+ ]
+}
\ No newline at end of file