Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and enable createOrUpdateUser test #554

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/test/java/org/zendesk/client/v2/RealSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1882,8 +1882,9 @@ public void getCustomAgentRoles() throws Exception {
}

@Test
@Ignore("Failing and I don't know why - caching issue ?")
// TODO: Fix this test
// Zendesk api behavior note - When update is used to change a phone number, a second phone number
// is added to the record. An update works as expected for non-identify fields, additional
// constraints exist for identify field updates
public void createOrUpdateUser() throws Exception {
createClientWithTokenOrPassword();

Expand All @@ -1895,30 +1896,30 @@ public void createOrUpdateUser() throws Exception {
instance.deleteUser(u.getId());
}

String phoneAtCreation = "5555551234";
String detailsAtCreation = "details at creation";
User user = new User(true, name);
user.setExternalId(externalId);
user.setPhone(phoneAtCreation);
user.setDetails(detailsAtCreation);

User createResult = instance.createOrUpdateUser(user);
assertNotNull(createResult);
assertNotNull(createResult.getId());
assertEquals(name, createResult.getName());
assertEquals(externalId, createResult.getExternalId());
assertEquals(phoneAtCreation, createResult.getPhone());
assertEquals(detailsAtCreation, createResult.getDetails());

String phoneAtUpdate = "5555551235";
String detailsAtUpdate = "details at update";
User updateUser = new User(true, name);
updateUser.setId(createResult.getId());
updateUser.setExternalId(externalId);
updateUser.setPhone(phoneAtUpdate);
updateUser.setDetails(detailsAtUpdate);

User updateResult = instance.createOrUpdateUser(updateUser);
assertNotNull(updateResult);
assertEquals(createResult.getId(), updateResult.getId());
assertEquals(name, updateResult.getName());
assertEquals(externalId, updateResult.getExternalId());
assertEquals(phoneAtUpdate, updateResult.getPhone());
assertEquals(detailsAtUpdate, updateResult.getDetails());

instance.deleteUser(updateResult);
}
Expand Down