/** * @see UserController#retireUser(User,String,WebRequest) * @verifies void a patient */ @Test public void retireUser_shouldRetireAUser() throws Exception { UserAndPassword user = new UserResource().getByUniqueId("c98a1558-e131-11de-babe-001e378eb67e"); Assert.assertFalse(user.isRetired()); new UserController() .delete( "c98a1558-e131-11de-babe-001e378eb67e", "unit test", emptyRequest(), new MockHttpServletResponse()); user = new UserResource().getByUniqueId("c98a1558-e131-11de-babe-001e378eb67e"); Assert.assertTrue(user.getUser().isRetired()); Assert.assertEquals("unit test", user.getUser().getRetireReason()); }
/** * @see UserController#updateUser(UserAndPassword,SimpleObject,WebRequest) * @verifies change a property on a patient */ @Test @Ignore("RESTWS-242: Define creatable/updatable properties on UserResource resource") public void updateUser_shouldChangeAPropertyOnAUser() throws Exception { UserAndPassword user = new UserResource().getByUniqueId("c98a1558-e131-11de-babe-001e378eb67e"); Assert.assertFalse("5-6".equals(user.getUser().getSystemId())); SimpleObject post = new ObjectMapper() .readValue("{\"systemId\":\"5-6\",\"password\":\"Admin@123\"}", SimpleObject.class); Object editedUser = new UserController() .update( "c98a1558-e131-11de-babe-001e378eb67e", post, emptyRequest(), new MockHttpServletResponse()); Util.log("Edited SystemId", editedUser); user = new UserResource().getByUniqueId("c98a1558-e131-11de-babe-001e378eb67e"); Assert.assertEquals("5-6", user.getUser().getSystemId()); }