use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class UserResourceTest method testGetUser.
@Test
public void testGetUser() {
when(usersDao.findByEmail(email.getAddress())).thenReturn(user);
Response response = resource.getUser(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 VerificationResourceTest method testVerifyUserSuccess.
@Test
public void testVerifyUserSuccess() {
when(usersDao.findByEmail(anyString())).thenReturn(nullDatabaseTokenMockUser);
when(usersDao.update(anyString(), any(PilotUser.class))).thenReturn(unverifiedMockUser);
when(emailService.sendEmail(any(Email.class), anyString(), anyString(), anyString())).thenReturn(true);
Response response = resource.createVerificationEmail(key, "test@test.com", "password");
PilotUser result = (PilotUser) response.getEntity();
assertEquals(response.getStatusInfo(), Response.Status.OK);
assertEquals(unverifiedMockUser, result);
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class VerificationResourceTest method testVerifyEmailSuccess.
@Test
public void testVerifyEmailSuccess() {
when(usersDao.findByEmail("test@test.com")).thenReturn(unverifiedMockUser);
when(usersDao.update(unverifiedMockUser.getEmail().getAddress(), verifiedMockUser)).thenReturn(verifiedMockUser);
Response response = resource.verifyEmail("test@test.com", "verificationToken", ResponseType.JSON);
PilotUser result = (PilotUser) response.getEntity();
assertEquals(response.getStatusInfo(), Response.Status.OK);
assertEquals(verifiedMockUser, result);
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class ThunderClientTest method testSendVerificationEmail.
@Test
@SuppressWarnings("ConstantConditions")
public void testSendVerificationEmail() throws IOException {
PilotUser response = client.sendVerificationEmail("email", password).execute().body();
assertEquals(user.getEmail(), response.getEmail());
}
use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.
the class ThunderClientTest method testPostUser.
@Test
@SuppressWarnings("ConstantConditions")
public void testPostUser() throws IOException {
PilotUser response = client.postUser(user).execute().body();
assertEquals(user.getEmail(), response.getEmail());
}
Aggregations