-
Notifications
You must be signed in to change notification settings - Fork 9
Dx 2688 Conferences Integration Tests #98
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
Conversation
test/integration/test_conferences.py
Outdated
| time.sleep(2) | ||
| list_conferences_response = self.conference_api_instance.list_conferences(BW_ACCOUNT_ID, _return_http_data_only=False) | ||
|
|
||
| time.sleep(2) |
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.
Why the duplicate sleep?
test/integration/test_conferences.py
Outdated
| # Get Conference Information | ||
| """Validate a Get Conference Information Request | ||
| """ |
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.
Are these random docstrings lefotver from copy/pasting functions?
| testRecordId = "Recording-Id" | ||
|
|
||
|
|
||
| class ConferencesIntegration(unittest.TestCase): |
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.
Can some of the refactoring done for Calls API Test be applied here as well?
test/integration/test_conferences.py
Outdated
| elif get_call_response[0].state == 'complete': | ||
| callIdArray.remove(callId) | ||
| callIdArray.clear() | ||
| pass |
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.
Refactoring This function is used in multiple Tests, opportunity to remove duplication. We can create a base Test Class with common functionality including this function and use where applicable for Calls API usage.
bpateldx
left a comment
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.
Nice work - removing ~100 lines of code from Test class - inheritance is worth trying if there is more commonality.
test/integration/test_conferences.py
Outdated
| from test.utils.env_variables import * | ||
| from test.utils.call_cleanup import callCleanup | ||
| import json | ||
| import time | ||
| from typing import List, Tuple | ||
| import unittest | ||
| from hamcrest import assert_that, has_properties, not_none, instance_of, greater_than | ||
|
|
||
|
|
||
| import bandwidth | ||
| from bandwidth.api import calls_api | ||
| from bandwidth.model.create_call import CreateCall | ||
| from bandwidth.model.create_call_response import CreateCallResponse | ||
| from bandwidth.model.call_state import CallState | ||
| from bandwidth.model.call_state_enum import CallStateEnum | ||
| from bandwidth.model.update_call import UpdateCall | ||
| from bandwidth.model.redirect_method_enum import RedirectMethodEnum | ||
| from bandwidth.api import conferences_api | ||
| from bandwidth.model.conference_state_enum import ConferenceStateEnum | ||
| from bandwidth.model.conference_recording_metadata import ConferenceRecordingMetadata | ||
| from bandwidth.model.update_conference import UpdateConference | ||
| from bandwidth.model.update_conference_member import UpdateConferenceMember | ||
| from bandwidth.model.file_format_enum import FileFormatEnum | ||
| from bandwidth.rest import RESTClientObject, RESTResponse | ||
| from bandwidth.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException |
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.
Order of imports in python according to Pep8 is
built in libraries
3rd party installed libraries
local modules
import time
import hamcrest
import bandwidth
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.
IMO we should implement autopep8 or black to run on all PRs and autoformat code
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.
OK, I changed the order of imports but I think implementing something. like autopep8 should be moved to a new card
test/integration/test_conferences.py
Outdated
| # Two Valid API Clients | ||
| self.calls_api_instance = calls_api.CallsApi(api_client) | ||
| self.conference_api_instance = conferences_api.ConferencesApi(api_client) | ||
|
|
||
| # Unauthorized API Client | ||
|
|
||
| unauthorizedConfiguration = bandwidth.Configuration( |
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.
Inconsistent # comment spacing - IMO your variable names are specific enough that we dont need these comments
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.
Good catch, I removed most of those comments.
| def tearDown(self): | ||
| callCleanup(self) | ||
|
|
||
| def assertApiException(self, context: ApiException, expectedException: ApiException, expected_status_code: int): |
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.
We should probably move this to a test utils module or something since its reused in multiple tests
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.
Doesnt need to get done here - just thinking out loud
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.
I like this idea too, but I think it needs to be on a separate card since we'll also have to modify all the other integration tests that use this function so it's a bit out of the scope of the conferences card
| # List Conferences | ||
| list_conferences_response = self.conference_api_instance.list_conferences(BW_ACCOUNT_ID, _return_http_data_only=False) | ||
|
|
||
| assert_that(list_conferences_response[1], 200) |
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.
More thinking out loud - I desipise the fact that _return_http_data_only returns a tuple and not a named tuple - if we can implement this without breaking anything (which I think we can since named tuples allow you to reference the key) - it might be a nice addition. Calling the index feels very cheesy to me
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.
I like this too, but same as above I think this with the other improvements can be added to another card that we can do next sprint or at some point
test/integration/test_conferences.py
Outdated
| # Get Conference Member | ||
| """Validate a GET Conference Member | ||
| """ | ||
| get_conference_member_response = self.conference_api_instance.get_conference_member(BW_ACCOUNT_ID, conferenceId, callId, _return_http_data_only=False) | ||
| assert_that(get_conference_member_response[1], 200) | ||
| assert_that(get_conference_member_response[0].conference_id, conferenceId) | ||
| assert_that(get_conference_member_response[0].call_id, callId) | ||
|
|
||
| # Update Conference Member | ||
| """Validate an Update Conference Member Request | ||
| """ | ||
|
|
||
| time.sleep(self.TEST_SLEEP) |
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.
More inconsistent comment spacing
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.
Should be good now
ajrice6713
left a comment
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 other than the imports spacing
Co-authored-by: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
No description provided.