Skip to content

DX-2684 Integration Tests Calls API#94

Merged
brianluisgomez merged 24 commits intofeature/openapi-generator-sdkfrom
DX-2684
Aug 5, 2022
Merged

DX-2684 Integration Tests Calls API#94
brianluisgomez merged 24 commits intofeature/openapi-generator-sdkfrom
DX-2684

Conversation

@brianluisgomez
Copy link
Contributor

No description provided.

@brianluisgomez brianluisgomez changed the base branch from main to feature/openapi-generator-sdk July 19, 2022 18:04
@brianluisgomez brianluisgomez marked this pull request as ready for review July 21, 2022 19:42
@brianluisgomez brianluisgomez requested a review from a team July 21, 2022 19:42
Copy link

@bpateldx bpateldx left a comment

Choose a reason for hiding this comment

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

Don't see any major issues. Some room for refactoring and minor updates. Note that 8 Tests failed locally for me, possible misconfiguration!

from bandwidth.model.update_call import UpdateCall
from bandwidth.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException

try:
Copy link

Choose a reason for hiding this comment

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

+1 on one-time setup for all Tests.

How can this be refactored to a Test util function?

Copy link

Choose a reason for hiding this comment

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

To clarify the comment further - Thinking from OOP perspective we've a Test class where all Test methods are encapsulated and then we've other "one-time" setup code above class definition! This can be either moved to @classmethod(suggested) or externalized to a static utility function lib.

priority=5,
tag="tag_example",
)

Copy link

Choose a reason for hiding this comment

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

What do you think about replacing the setup block by a function call (ex. create_call_body)? In case on replaced function call, how much of the relevant info should stay in calling function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do that, but this particular call body is only used once for this initial test to make sure that we can send all of these parameters. The future call bodies that I use in the tests are smaller and I am making a separate global variable that gets reused for that.

Copy link

Choose a reason for hiding this comment

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

Agreed on it being not re-used. The suggestion is to reduce ~30 lines to a line(or two) so that it's easy to understand the test structure at high level. Doing it will help fellow developer to easily understand the test setup (create call), action under test and validations. To dig more into create_call_setup one simply click open the implementing method.

self.assertIsInstance((get_call_response[0].direction), CallDirectionEnum)
self.assertIs(type(get_call_response[0].enqueued_time), datetime.datetime)
self.assertIs(type(get_call_response[0].last_update), datetime.datetime)
self.assertIs(type(get_call_response[0].start_time), datetime.datetime)
Copy link

Choose a reason for hiding this comment

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

Is it worth checking that start_time is after our first call and last_update to be after start_time?

Copy link

@bpateldx bpateldx left a comment

Choose a reason for hiding this comment

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

👍 for all refactoring and Test assertions using hamcrest matchers

@brianluisgomez brianluisgomez merged commit 9609fd3 into feature/openapi-generator-sdk Aug 5, 2022
@brianluisgomez brianluisgomez deleted the DX-2684 branch August 5, 2022 20:40
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.

3 participants