Search in sources :

Example 21 with PilotUser

use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.

the class UserResourceTest method testUpdateUserInvalidEmail.

@Test
public void testUpdateUserInvalidEmail() {
    PilotUser user = new PilotUser(badEmail, "password", "", "", "");
    Response response = resource.updateUser(key, "password", email.getAddress(), user);
    assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
}
Also used : Response(javax.ws.rs.core.Response) PilotUser(com.sanction.thunder.models.PilotUser) Test(org.junit.Test)

Example 22 with PilotUser

use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.

the class ThunderClientTest method testDeleteUser.

@Test
@SuppressWarnings("ConstantConditions")
public void testDeleteUser() throws IOException {
    PilotUser response = client.deleteUser("email", password).execute().body();
    assertEquals(user.getEmail(), response.getEmail());
}
Also used : PilotUser(com.sanction.thunder.models.PilotUser) Test(org.junit.Test)

Example 23 with PilotUser

use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.

the class ThunderClientTest method testVerifyUser.

@Test
@SuppressWarnings("ConstantConditions")
public void testVerifyUser() throws IOException {
    PilotUser response = client.verifyUser("email", "token").execute().body();
    assertEquals(user.getEmail(), response.getEmail());
}
Also used : PilotUser(com.sanction.thunder.models.PilotUser) Test(org.junit.Test)

Example 24 with PilotUser

use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.

the class UsersDaoTest method testSuccessfulEmailUpdate.

@Test
public void testSuccessfulEmailUpdate() {
    when(table.getItem(anyString(), anyString())).thenReturn(item);
    PilotUser result = usersDao.update("existingEmail", user);
    assertEquals(user, result);
    verify(table, times(1)).getItem(anyString(), anyString());
    verify(table, times(1)).deleteItem(any(DeleteItemSpec.class));
    verify(table, times(1)).putItem(any(Item.class), any(Expected.class));
}
Also used : DeleteItemSpec(com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec) Item(com.amazonaws.services.dynamodbv2.document.Item) Expected(com.amazonaws.services.dynamodbv2.document.Expected) PilotUser(com.sanction.thunder.models.PilotUser) Test(org.junit.Test)

Example 25 with PilotUser

use of com.sanction.thunder.models.PilotUser in project thunder by RohanNagar.

the class UsersDaoTest method testSuccessfulDelete.

@Test
public void testSuccessfulDelete() {
    when(table.getItem(anyString(), anyString())).thenReturn(item);
    PilotUser result = usersDao.delete("email");
    verify(table, times(1)).getItem(anyString(), anyString());
    verify(table, times(1)).deleteItem(any(DeleteItemSpec.class));
    assertEquals(user, result);
}
Also used : DeleteItemSpec(com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec) PilotUser(com.sanction.thunder.models.PilotUser) Test(org.junit.Test)

Aggregations

PilotUser (com.sanction.thunder.models.PilotUser)26 Test (org.junit.Test)20 Response (javax.ws.rs.core.Response)9 DatabaseException (com.sanction.thunder.dao.DatabaseException)6 Email (com.sanction.thunder.models.Email)4 Expected (com.amazonaws.services.dynamodbv2.document.Expected)3 Item (com.amazonaws.services.dynamodbv2.document.Item)3 DeleteItemSpec (com.amazonaws.services.dynamodbv2.document.spec.DeleteItemSpec)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 URI (java.net.URI)1 StringJoiner (java.util.StringJoiner)1 DELETE (javax.ws.rs.DELETE)1 PUT (javax.ws.rs.PUT)1