@Test
public void testUpdateSettings() throws Exception {
Map<String, String> updated = new HashMap<String, String>();
// grab current setting
ServerSettings settings = RpcUtils.getSettings(url, account, password.toCharArray());
boolean showSizes = settings.get(Keys.web.showRepositorySizes).getBoolean(true);
showSizes = !showSizes;
// update setting
updated.put(Keys.web.showRepositorySizes, String.valueOf(showSizes));
boolean success = RpcUtils.updateSettings(updated, url, account, password.toCharArray());
assertTrue("Failed to update server settings", success);
// confirm setting change
settings = RpcUtils.getSettings(url, account, password.toCharArray());
boolean newValue = settings.get(Keys.web.showRepositorySizes).getBoolean(false);
assertEquals(newValue, showSizes);
// restore setting
newValue = !newValue;
updated.put(Keys.web.showRepositorySizes, String.valueOf(newValue));
success = RpcUtils.updateSettings(updated, url, account, password.toCharArray());
assertTrue("Failed to update server settings", success);
settings = RpcUtils.getSettings(url, account, password.toCharArray());
showSizes = settings.get(Keys.web.showRepositorySizes).getBoolean(true);
assertEquals(newValue, showSizes);
}