-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Implementation of "Users.GetIncrementalUserExport" and "Users.GetIncrementalUserExportNextPage" (+Async versions) #347
Conversation
- Added support for CRUD operations of Comments on Articles and Posts
…ementalUserExportNextPage" (+Async versions)
|
||
[JsonProperty("end_time")] | ||
[JsonConverter(typeof(UnixDateTimeConverter))] | ||
public DateTime EndTime { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this a DattimeOffset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it should also change in GroupTicketExportResponse (The class is based on that)... but that would be a breaking change so do not know if what is best. Make it right here and not make it consistent across the framework or have it same format. Up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It get what you are saying but let's make this class match the rest of the code by using DateTimeOffset and add an issue to fix the other.
I make breaking changes as needed. My goal with version 4 and above is to follow semantic versioning but for now, let's make the new code correct.
@@ -497,5 +497,69 @@ public void CanBulkDeleteUsers() | |||
Assert.AreEqual(JobStatusCompleted, jobResponse.JobStatus.Status.ToLower()); | |||
Assert.AreEqual(users.Count, jobResponse.JobStatus.Total); | |||
} | |||
|
|||
[Test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you plan on handling the rate limit in the test?
https://developer.zendesk.com/rest_api/docs/core/incremental_export#rate-limits
https://developer.zendesk.com/rest_api/docs/core/incremental_export#incremental-sample-export
May be we add a category to the test so if needed we can mark them as do not run? https://github.com/nunit/docs/wiki/Category-Attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am a fan fo the Assert.That() method of unit it test assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate Limit
Do you run all tests that often? In my daily work, we have used the incremental Ticket Export and we are yet to hit the limit in actual use.
So gut feeling is wait and see if it becomes a problem and if so it could be built in that it have a "LastExecuted.txt" file in %temp% and if run too often.
But given that the test CanGetIncrementalTicketExportWithGroupsSideLoadPaged have not given an issue I guess this will not either (have same rate limit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding Assert.That
I can change my unit-tests to that (I normally use MS-Test and not nUnit and they do not have the Assert.That so not used to that)...
Practical how do I make this change to the PR? (Is it a new PR?) [Sorry: still very noob on this Git and PR thing]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this style OK (Assert.That feels clunky for null/not Null checks)?
[Test]
public void CanGetIncrementalUserExport()
{
var incrementalUserExport = api.Users.GetIncrementalUserExport(DateTimeOffset.MinValue);
Assert.That(incrementalUserExport.Users.Count, Is.GreaterThan(0));
Assert.IsNull(incrementalUserExport.Organizations);
Assert.IsNull(incrementalUserExport.Identities);
Assert.IsNull(incrementalUserExport.Groups);
var incrementalUserExportNextPage = api.Users.GetIncrementalUserExportNextPage(incrementalUserExport.NextPage);
Assert.That(incrementalUserExportNextPage.Users.Count, Is.GreaterThan(0));
Assert.IsNull(incrementalUserExportNextPage.Organizations);
Assert.IsNull(incrementalUserExportNextPage.Identities);
Assert.IsNull(incrementalUserExportNextPage.Groups);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjdk for updating the PR just update the branch on your fork and it will auto update the PR
As for the test cases I like the
[Test]
public void CanGetIncrementalUserExport()
{
var incrementalUserExport = api.Users.GetIncrementalUserExport(DateTimeOffset.MinValue);
Assert.That(incrementalUserExport.Users.Count, Is.GreaterThan(0));
Assert.That(incrementalUserExport.Organizations, Is.Null);
Assert.That(incrementalUserExport.Identities, Is.Null);
Assert.That(incrementalUserExport.Groups, Is.Null);
var incrementalUserExportNextPage = api.Users.GetIncrementalUserExportNextPage(incrementalUserExport.NextPage);
Assert.That(incrementalUserExportNextPage.Users.Count, Is.GreaterThan(0));
Assert.That(incrementalUserExportNextPage.Organizations, Is.Null);
Assert.That(incrementalUserExportNextPage.Identities, Is.Null);
Assert.That(incrementalUserExportNextPage.Groups, Is.Null);
}
The "That" format reads as English which helps new people to coding and is the format recommended by the NUnit team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point :-) - Change made to the tests now
Requested changes are now updated in PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thanks for all the changes.
…rementalUserExportNextPage" (+Async versions) (Speedygeek#347) * Test "CanCreateTicketWithDueDate" can't run on PCs that use dd/MM/yyyy as time format * Added Code to make tests work * - Added support for issue Speedygeek#330 - Added support for CRUD operations of Comments on Articles and Posts * Implementation of "Users.GetIncrementalUserExport" and "Users.GetIncrementalUserExportNextPage" (+Async versions) * Changes to PR based on @mozts2005’s request * Changed Assert Style
Implementation of "Users.GetIncrementalUserExport" and "Users.GetIncrementalUserExportNextPage" (+Async versions)
Requested in #315
UnitTests are a bit slow (All IncrementalExport are) but better to have them or not