Skip to content

Commit

Permalink
login steps changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xipi3000 committed Mar 7, 2024
1 parent 77e2c06 commit ec72d55
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/test/java/cat/udl/eps/softarch/demo/steps/LoginStepDefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ public void thereIsARegisteredUserWithUsernameAndPassword(String username, Strin
}
}

@And("^And I'm not logged in$")
public void iMNotLoggedIn(String username) throws Throwable {

}

@When("^I login with username \"([^\"]*)\" and password \"([^\"]*)\"$")
public void iLoginWithUsernameAndPassword(String username, String password) throws Exception {
AuthenticationStepDefs.currentUsername = username;
AuthenticationStepDefs.currentPassword = password;

stepDefs.result = stepDefs.mockMvc.perform(
get("/users/{username}", username)
.accept(MediaType.APPLICATION_JSON)
.with(AuthenticationStepDefs.authenticate()))
.andDo(print())
.andExpect(jsonPath("$.password").doesNotExist());
get("/identity")
.accept(MediaType.APPLICATION_JSON)
.with(AuthenticationStepDefs.authenticate()))
.andDo(print());
}


Expand Down

0 comments on commit ec72d55

Please sign in to comment.