use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUser.
@Test
public void testUpdateUser() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
when(usersDao.update(null, updatedUser)).thenReturn(updatedUser);
Response response = resource.updateUser(key, "password", null, updatedUser);
PilotUser result = (PilotUser) response.getEntity();
assertEquals(Response.Status.OK, response.getStatusInfo());
assertEquals(updatedUser, result);
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testUpdateUserWithNewEmail.
@Test
public void testUpdateUserWithNewEmail() {
when(usersDao.findByEmail("existingEmail")).thenReturn(user);
when(usersDao.update("existingEmail", updatedUser)).thenReturn(updatedUser);
Response response = resource.updateUser(key, "password", "existingEmail", updatedUser);
PilotUser result = (PilotUser) response.getEntity();
assertEquals(Response.Status.OK, response.getStatusInfo());
assertEquals(updatedUser, result);
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testPostUserInvalidEmail.
@Test
public void testPostUserInvalidEmail() {
PilotUser user = new PilotUser(badEmail, "password", "", "", "");
Response response = resource.postUser(key, user);
assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testDeleteUser.
@Test
public void testDeleteUser() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
when(usersDao.delete(email.getAddress())).thenReturn(user);
Response response = resource.deleteUser(key, "password", email.getAddress());
PilotUser result = (PilotUser) response.getEntity();
assertEquals(Response.Status.OK, response.getStatusInfo());
assertEquals(user, result);
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testPostUser.
@Test
public void testPostUser() {
when(usersDao.insert(any(PilotUser.class))).thenReturn(updatedUser);
Response response = resource.postUser(key, user);
PilotUser result = (PilotUser) response.getEntity();
assertEquals(Response.Status.CREATED, response.getStatusInfo());
assertEquals(updatedUser, result);
}
Aggregations