Commit 21734ff6 authored by Bergamote Orange's avatar Bergamote Orange
Browse files

tests(integration-tests): expect 200 OK when 0 visits are accepted

parent 1d6ea9b6
Pipeline #283916 failed with stages
in 8 minutes and 31 seconds
...@@ -136,7 +136,7 @@ public class CleaReportSteps { ...@@ -136,7 +136,7 @@ public class CleaReportSteps {
.then() .then()
.contentType(ContentType.JSON) .contentType(ContentType.JSON)
.statusCode(200) .statusCode(200)
.body("message", equalTo("0 reports processed, 1 rejected")) .body("message", equalTo("0/1 accepted visits"))
.extract() .extract()
.as(WreportResponse.class); .as(WreportResponse.class);
visitor.setLastReportResponse(response); visitor.setLastReportResponse(response);
...@@ -158,8 +158,8 @@ public class CleaReportSteps { ...@@ -158,8 +158,8 @@ public class CleaReportSteps {
.post(cleaReportUrl) .post(cleaReportUrl)
.then() .then()
.contentType(ContentType.JSON) .contentType(ContentType.JSON)
.statusCode(400) .statusCode(200)
.body("message", equalTo("Invalid request")); .body("message", equalTo("0/1 accepted visits"));
} }
@Then("{word} has {int} rejected visit(s)") @Then("{word} has {int} rejected visit(s)")
......
...@@ -3,7 +3,6 @@ package fr.gouv.clea.integrationtests.service; ...@@ -3,7 +3,6 @@ package fr.gouv.clea.integrationtests.service;
import fr.gouv.clea.integrationtests.config.ApplicationProperties; import fr.gouv.clea.integrationtests.config.ApplicationProperties;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.BufferedReader; import java.io.BufferedReader;
......
...@@ -13,7 +13,8 @@ public class CleaApiResponseParser { ...@@ -13,7 +13,8 @@ public class CleaApiResponseParser {
final var matcher = REPORT_MESSAGE_RESPONSE_PATTERN.matcher(message); final var matcher = REPORT_MESSAGE_RESPONSE_PATTERN.matcher(message);
if (!matcher.find()) { if (!matcher.find()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
String.format("message '%s' doesn't match pattern %s", message, REPORT_MESSAGE_RESPONSE_PATTERN)); String.format("message '%s' doesn't match pattern %s", message, REPORT_MESSAGE_RESPONSE_PATTERN)
);
} }
final var accepted = Integer.parseInt(matcher.group(1)); final var accepted = Integer.parseInt(matcher.group(1));
final var total = Integer.parseInt(matcher.group(2)); final var total = Integer.parseInt(matcher.group(2));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment