ReadOnlyByHttpIT: Extend assertions on response content
Since change I6fe0414a4 the response from PUT and DELETE requests
includes "on" or "off". Extend the assertions to cover this.
Change-Id: I526067b2208350a8e8a6e93db12f141146649d4e
diff --git a/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyByHttpIT.java b/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyByHttpIT.java
index 43f241c..9cc4f15 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyByHttpIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/readonly/ReadOnlyByHttpIT.java
@@ -21,14 +21,19 @@
public class ReadOnlyByHttpIT extends AbstractReadOnlyTest {
@Override
protected void setReadOnly(boolean readOnly) throws Exception {
- if (readOnly) {
- adminRestSession.put("/config/server/readonly~readonly").assertOK();
- } else {
- adminRestSession.delete("/config/server/readonly~readonly").assertOK();
- }
- RestResponse response = adminRestSession.get("/config/server/readonly~readonly");
- response.assertOK();
String expectedStatus = readOnly ? "on" : "off";
+ RestResponse response;
+ if (readOnly) {
+ response = adminRestSession.put("/config/server/readonly~readonly");
+ response.assertOK();
+ assertThat(response.getEntityContent()).contains(expectedStatus);
+ } else {
+ response = adminRestSession.delete("/config/server/readonly~readonly");
+ response.assertOK();
+ assertThat(response.getEntityContent()).contains(expectedStatus);
+ }
+ response = adminRestSession.get("/config/server/readonly~readonly");
+ response.assertOK();
assertThat(response.getEntityContent()).contains(expectedStatus);
}
}