← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10063: FRED-API: test POST/PUT without required properties

 

------------------------------------------------------------
revno: 10063
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-08 08:30:08 +0300
message:
  FRED-API: test POST/PUT without required properties
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 05:21:57 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/test/java/org/hisp/dhis/web/webapi/v1/controller/FacilityControllerTest.java	2013-03-08 05:30:08 +0000
@@ -199,6 +199,32 @@
     }
 
     @Test
+    public void testPutFacilityWithoutRequiredPropertiesUid() throws Exception
+    {
+        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
+        manager.save( organisationUnit );
+
+        MockHttpSession session = getSession( "ALL" );
+
+        mvc.perform( put( "/v1/facilities/" + organisationUnit.getUid() ).content( "{}" )
+            .session( session ).contentType( MediaType.APPLICATION_JSON ) )
+            .andExpect( status().isUnprocessableEntity() );
+    }
+
+    @Test
+    public void testPutFacilityWithoutRequiredPropertiesUuid() throws Exception
+    {
+        OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
+        manager.save( organisationUnit );
+
+        MockHttpSession session = getSession( "ALL" );
+
+        mvc.perform( put( "/v1/facilities/" + organisationUnit.getUuid() ).content( "{}" )
+            .session( session ).contentType( MediaType.APPLICATION_JSON ) )
+            .andExpect( status().isUnprocessableEntity() );
+    }
+
+    @Test
     public void testPutFacilityUid() throws Exception
     {
         OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
@@ -243,6 +269,16 @@
     //---------------------------------------------------------------------------------------------
 
     @Test
+    public void testPostWithoutRequiredProperties() throws Exception
+    {
+        MockHttpSession session = getSession( "ALL" );
+
+        mvc.perform( post( "/v1/facilities" ).content( "{}" )
+            .session( session ).contentType( MediaType.APPLICATION_JSON ) )
+            .andExpect( status().isUnprocessableEntity() );
+    }
+
+    @Test
     public void testPostName() throws Exception
     {
         MockHttpSession session = getSession( "ALL" );