Exemplo n.º 1
0
  @Test
  public void whenSignUpTwiceWithSameEmail_shouldFailOnSecondSignUp() throws Exception {
    HttpRequest signUpRequest = signUpRequest("*****@*****.**", "pass");
    assertThat(signUpRequest.code()).isEqualTo(CREATED.getStatusCode());

    HttpRequest signUpRequest2 = signUpRequest("*****@*****.**", "pass");
    assertThat(signUpRequest2.code()).isEqualTo(CONFLICT.getStatusCode());
  }
Exemplo n.º 2
0
  @Test
  public void signOut_shouldReturnTrue_ifSignsOutBeingSignedIn() throws Exception {
    HttpRequest signUpRequest = signUpRequest("*****@*****.**", "pass");
    assertThat(signUpRequest.code()).isEqualTo(CREATED.getStatusCode());
    String token = signUpRequest.body().toString();
    assertThat(token).isNotEmpty();

    HttpRequest signOutRequest = signOutRequest(token);
    assertThat(signOutRequest.code()).isEqualTo(OK.getStatusCode());
    assertThat(signOutRequest.body()).isEqualTo("true");
  }
Exemplo n.º 3
0
 @Test
 public void signUp_shouldCreateAnUser() throws Exception {
   HttpRequest signUpRequest = signUpRequest("*****@*****.**", "pass");
   assertThat(signUpRequest.code()).isEqualTo(CREATED.getStatusCode());
 }