Skip to content

Commit

Permalink
Added some test cases for moduleController1_8 (openmrs#292)
Browse files Browse the repository at this point in the history
Added some test cases for moduleController1_8

Added some test cases for moduleController1_8

Included test cases for Full, Default, and Ref representations.

Added some test cases for moduleController1_8
  • Loading branch information
suthagar23 authored and dkayiwa committed Aug 16, 2017
1 parent 7a39d69 commit e12f8c7
Showing 1 changed file with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,43 @@ public void shouldIncludeVersionToDefaultRepresentation() throws Exception {

Assert.assertNotNull(PropertyUtils.getProperty(result, "version"));
}


@Test
public void shouldIncludeAllPropertiesForFullRepresentation() throws Exception {
MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid());
req.addParameter("v", "full");
SimpleObject result = deserialize(handle(req));
Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "display"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "name"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "description"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "packageName"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "author"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "version"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "started"));
}

@Test
public void shouldIncludeAllPropertiesForDefaultRepresentation() throws Exception {
MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid());
SimpleObject result = deserialize(handle(req));
Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "display"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "name"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "description"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "version"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "started"));
}

@Test
public void shouldIncludeAllPropertiesForRefRepresentation() throws Exception {
MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid());
req.addParameter("v", "ref");
SimpleObject result = deserialize(handle(req));
Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid"));
Assert.assertNotNull(PropertyUtils.getProperty(result, "display"));
}

@Test
public void shouldUploadModule() throws Exception {
byte[] fileData = IOUtils.toByteArray(getClass().getClassLoader().getResourceAsStream("mockModule.omod"));
Expand Down

0 comments on commit e12f8c7

Please sign in to comment.