GetArchive: Test request with unknown format
Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I7ed7db22de28c8290864b581386c79d982901971
This commit is contained in:
@@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.acceptance.RestResponse;
|
||||
import com.google.gerrit.extensions.client.ArchiveFormat;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
@@ -41,6 +42,17 @@ public class GetArchiveIT extends AbstractDaemonTest {
|
||||
assertThat(ex).hasMessageThat().isEqualTo("format is not specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownFormat() throws Exception {
|
||||
// Test this by a REST call, since the Java API doesn't allow to specify an unknown format.
|
||||
RestResponse res =
|
||||
adminRestSession.get(
|
||||
String.format(
|
||||
"/changes/%s/revisions/current/archive?format=%s", changeId, "unknownFormat"));
|
||||
res.assertBadRequest();
|
||||
assertThat(res.getEntityContent()).isEqualTo("unknown archive format");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void zipFormatIsDisabled() throws Exception {
|
||||
MethodNotAllowedException ex =
|
||||
|
||||
Reference in New Issue
Block a user