dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21368
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10090: minor
------------------------------------------------------------
revno: 10090
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-08 21:37:42 +0300
message:
minor
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.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-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java 2013-03-08 15:17:40 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java 2013-03-08 18:37:42 +0000
@@ -37,6 +37,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpSession;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@@ -272,8 +273,6 @@
Facility facility = new OrganisationUnitToFacilityConverter().convert( organisationUnit );
facility.setUuid( "DUMMY_UUID" );
- facility.setName( "FacilityB" );
- facility.setActive( false );
MockHttpSession session = getSession( "ALL" );
@@ -282,6 +281,24 @@
.andExpect( status().isPreconditionFailed() );
}
+ // TODO: this should fail, need to figure out which code to return
+ @Test
+ public void testPutChangeUuidShouldFail() throws Exception
+ {
+ OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
+ organisationUnit.setUuid( "ddccbbaa-bbaa-bbaa-bbaa-ffeeddccbbaa" );
+ manager.save( organisationUnit );
+
+ Facility facility = new OrganisationUnitToFacilityConverter().convert( organisationUnit );
+ facility.setUuid( "aabbccdd-aabb-aabb-aabb-aabbccddeeff" );
+
+ MockHttpSession session = getSession( "ALL" );
+
+ mvc.perform( put( "/v1/facilities/" + organisationUnit.getUuid() ).content( objectMapper.writeValueAsString( facility ) )
+ .session( session ).contentType( MediaType.APPLICATION_JSON ) )
+ .andExpect( status().isOk() );
+ }
+
//---------------------------------------------------------------------------------------------
// Test POST
//---------------------------------------------------------------------------------------------