Leo/Backend/UnitTest #138
@ -117,7 +117,7 @@ public class UserControllerTest {
|
||||
|
||||
@Test
|
||||
public void userPatchTest(){
|
||||
User herobrine = new User("brine","hero","herobrine@admin.com","in your WalLs","ShadowsLand",new Date(0), null,Role.Student,"test");
|
||||
User herobrine = new User("brine","hero","herobrine@admin.com","in your WalLs","ShadowsLand",new Date(0), null,Role.Admin,"test");
|
||||
userRepository.save(herobrine);
|
||||
|
||||
Token t = new Token(herobrine, tokenService.generateNewToken(), new Date());
|
||||
@ -127,7 +127,7 @@ public class UserControllerTest {
|
||||
data.put("firstName", "test");
|
||||
|
||||
//Teste que le patch s'execute bien
|
||||
with().body(data).contentType(ContentType.JSON).header("Authorization", t.getToken()).when().request("PATCH", "/user").then().statusCode(200);
|
||||
with().body(data).contentType(ContentType.JSON).header("Authorization", t.getToken()).pathParam("id", herobrine.getRegNo()).when().request("PATCH", "/user/{id}").then().statusCode(200);
|
||||
|
||||
//Teste que la donnée a bien été altérée
|
||||
with().header("Authorization", t.getToken()).when().request("GET", "/user").then().body("firstName",equalTo("test"));
|
||||
|
Loading…
Reference in New Issue
Block a user