Initial commit change to negative test
This commit is contained in:
parent
1668dcabe4
commit
623097245c
@ -9,6 +9,7 @@ import model.Status;
|
||||
import model.Ticket;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Random;
|
||||
|
||||
@ -4,6 +4,10 @@ import model.AuthToken;
|
||||
import model.Status;
|
||||
import model.Ticket;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
|
||||
/** Обновление тикета */
|
||||
@ -14,27 +18,24 @@ public class UpdateTicketTest extends BaseTest {
|
||||
public void updateTicketTest() {
|
||||
Ticket ticket = buildNewTicket(Status.CLOSED, 1);
|
||||
Ticket posted = createTicket(ticket);
|
||||
|
||||
posted.setStatus(Status.OPEN.getCode());
|
||||
updateTicketNegative(posted);
|
||||
|
||||
}
|
||||
|
||||
private void updateTicketNegative(Ticket ticket) {
|
||||
AuthToken authToken = login();
|
||||
String token = authToken.getToken();
|
||||
|
||||
int id = ticket.getId();
|
||||
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("comment", "Изменение статуса");
|
||||
body.put("new_status", "");//Status.OPEN возвращает 201
|
||||
|
||||
given()
|
||||
.header("Authorization", "Token " + token)
|
||||
.pathParam("ticketId", id)
|
||||
.body(ticket)
|
||||
.body(body)
|
||||
.when()
|
||||
.put("/api/tickets/{ticketId}")
|
||||
.put("/api/tickets/{ticketId}/followup")
|
||||
.then()
|
||||
.statusCode(200) //helpdesk дает сенять тикет со статусом closed
|
||||
.statusCode(400)
|
||||
.extract().as(Ticket.class);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user