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

Add test to timezone.get_offset API call #261

Merged
merged 5 commits into from
Mar 26, 2019

Conversation

drago8888
Copy link
Contributor

Signed-off-by: Drago8888 rjmateus1985@gmail.com

Signed-off-by: Drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
@drago8888
Copy link
Contributor Author

Challenge from Ricardo Mateus

Copy link
Member

@renner renner left a comment

Choose a reason for hiding this comment

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

Thanks for adding those tests, your patch looks good to me! I only have some minor comments with suggestions for your consideration.

assertEquals(JsonNull.INSTANCE,
((JsonParsingError) response.get("minion1").error().get()).getJson());

// Test for successful responses
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to test each case separately here, would you maybe want to move this second use case into a separate method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you, I think each case should be in a separated method and that was my first approach.
The reason behind my change of approach was to keep the consistency with the rest of the project test, with one test method per function with several scenarios.
However in this case following the right way instead of consistency seems not to bring any harm to the future of the project, therefore I will split the test into two as suggested.

TimezoneTest.class.getResourceAsStream(
"/modules/timezone/null_response.json"));

private static final String JSON_GETOFFESET_OK_RESPONSE = ClientUtils.streamToString(
Copy link
Member

Choose a reason for hiding this comment

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

There is a typo in this name, should be JSON_GETOFFSET_OK_RESPONSE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks


private static final String JSON_GETOFFESET_OK_RESPONSE = ClientUtils.streamToString(
TimezoneTest.class.getResourceAsStream(
"/modules/timezone/getOffset_ok.json"));
Copy link
Member

Choose a reason for hiding this comment

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

May I suggest to rename that file in order to avoid mixing underscore with camel case notations to get_offset_ok.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. Thanks

@renner renner added this to the Version 0.16.0 milestone Mar 19, 2019
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
Signed-off-by: drago8888 <rjmateus1985@gmail.com>
@renner renner merged commit 3c6b0be into SUSE:master Mar 26, 2019
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.

None yet

2 participants