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

Implementation of "Users.GetIncrementalUserExport" and "Users.GetIncrementalUserExportNextPage" (+Async versions) #347

Merged
merged 10 commits into from
Jun 23, 2018

Conversation

rwjdk
Copy link

@rwjdk rwjdk commented Jun 23, 2018

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

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link


[JsonProperty("end_time")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime EndTime { get; set; }
Copy link
Member

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

Copy link
Author

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

Copy link
Member

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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

Copy link
Author

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)

Copy link
Author

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]

Copy link
Author

@rwjdk rwjdk Jun 23, 2018

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);
        }

Copy link
Member

@mozts2005 mozts2005 Jun 23, 2018

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.

Copy link
Author

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

@AppVeyorBot
Copy link

@rwjdk
Copy link
Author

rwjdk commented Jun 23, 2018

Requested changes are now updated in PR

Copy link
Member

@mozts2005 mozts2005 left a 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.

@AppVeyorBot
Copy link

@mozts2005 mozts2005 merged commit fd8f06d into Speedygeek:master Jun 23, 2018
abc516 pushed a commit to abc516/ZendeskApi_v2 that referenced this pull request Oct 30, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants