GeneralPreferencesIT: Use helper methods from RestResponse
Change-Id: Id770148baafefaac140408812a69b2c850de8b07
This commit is contained in:
parent
34e084ed54
commit
5f8ce2c486
@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.acceptance.rest.account;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.acceptance.RestResponse;
|
||||
@ -29,7 +28,6 @@ import com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategory
|
||||
import com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat;
|
||||
import com.google.gerrit.extensions.client.MenuItem;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -48,16 +46,15 @@ public class GeneralPreferencesIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void getDiffPreferencesOfNonExistingAccount_NotFound()
|
||||
throws Exception {
|
||||
assertEquals(HttpStatus.SC_NOT_FOUND,
|
||||
adminSession.get("/accounts/non-existing/preferences")
|
||||
.getStatusCode());
|
||||
RestResponse r = adminSession.get("/accounts/non-existing/preferences");
|
||||
r.assertNotFound();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAndSetPreferences() throws Exception {
|
||||
RestResponse r = adminSession.get("/accounts/" + user42.email
|
||||
+ "/preferences");
|
||||
assertEquals(HttpStatus.SC_OK, r.getStatusCode());
|
||||
r.assertOK();
|
||||
GeneralPreferencesInfo d = GeneralPreferencesInfo.defaults();
|
||||
GeneralPreferencesInfo o =
|
||||
newGson().fromJson(r.getReader(), GeneralPreferencesInfo.class);
|
||||
@ -104,7 +101,7 @@ public class GeneralPreferencesIT extends AbstractDaemonTest {
|
||||
i.urlAliases.put("foo", "bar");
|
||||
|
||||
r = adminSession.put("/accounts/" + user42.email + "/preferences", i);
|
||||
assertEquals(HttpStatus.SC_OK, r.getStatusCode());
|
||||
r.assertOK();
|
||||
o = newGson().fromJson(r.getReader(), GeneralPreferencesInfo.class);
|
||||
|
||||
assertThat(o.changesPerPage).isEqualTo(i.changesPerPage);
|
||||
|
Loading…
Reference in New Issue
Block a user