InlineEdit: Add GET /changes/{id}/edit/{path}/type endpoint

Change-Id: I3b5bb2fab294e5ba560ac2db32dcc80055bdc6a8
This commit is contained in:
David Ostrovsky
2014-11-13 22:05:06 +01:00
parent b6b88ebe9c
commit b75de18d51
5 changed files with 98 additions and 1 deletions

View File

@@ -484,6 +484,18 @@ public class ChangeEditIT extends AbstractDaemonTest {
.isEqualTo(StringUtils.newStringUtf8(CONTENT_NEW2));
}
@Test
public void getFileContentTypeRest() throws Exception {
Put.Input in = new Put.Input();
in.content = RestSession.newRawInput(CONTENT_NEW);
assertThat(adminSession.putRaw(urlEditFile(), in.content).getStatusCode())
.isEqualTo(SC_NO_CONTENT);
RestResponse r = adminSession.get(urlEditFileContentType());
assertThat(r.getStatusCode()).isEqualTo(SC_OK);
String res = newGson().fromJson(r.getReader(), String.class);
assertThat(res).isEqualTo("application/octet-stream");
}
@Test
public void getFileNotFoundRest() throws Exception {
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
@@ -606,6 +618,13 @@ public class ChangeEditIT extends AbstractDaemonTest {
+ FILE_NAME;
}
private String urlEditFileContentType() {
return urlEdit()
+ "/"
+ FILE_NAME
+ "/type";
}
private String urlGetFiles() {
return urlEdit()
+ "?list";