@Test
@RunAsClient
public void putAccountJson() throws Exception {
// New Account
Account a =
new Account("aacount2@localhost.com", "Sample Account",
"sampleaccount", "/9Se/pfHeUH8FJ4asBD6jQ==");
ZanataProxyFactory proxyFactory =
createClientProxyFactory(ADMIN, ADMIN_KEY);
UnimplementedIAccountResource accountClient =
super.createProxy(proxyFactory,
UnimplementedIAccountResource.class,
"/accounts/u/sampleaccount");
IAccountResource originalAccountClient =
super.createProxy(proxyFactory, IAccountResource.class,
"/accounts/u/sampleaccount");
ClientResponse putResponse = accountClient.putJson(a);
// Assert initial put
assertThat(putResponse.getStatus(), is(Status.CREATED.getStatusCode()));
putResponse.releaseConnection();
// Modified Account
a.setName("New Account Name");
putResponse = accountClient.putJson(a);
putResponse.releaseConnection();
// Assert modification
assertThat(putResponse.getStatus(), is(Status.OK.getStatusCode()));
// Retrieve again
Account a2 = originalAccountClient.get().getEntity();
assertThat(a2.getUsername(), is(a.getUsername()));
assertThat(a2.getApiKey(), is(a.getApiKey()));
assertThat(a2.getEmail(), is(a.getEmail()));
assertThat(a2.getName(), is(a.getName()));
assertThat(a2.getPasswordHash(), is(a.getPasswordHash()));
assertThat(a2.getRoles().size(), is(0));
// assertThat(a2.getTribes().size(), is(1)); // Language teams are not
// being returned
}