Skip to content

Conversation

@brianluisgomez
Copy link
Contributor

No description provided.

@brianluisgomez brianluisgomez requested a review from a team August 2, 2022 04:41
@brianluisgomez brianluisgomez changed the base branch from main to feature/openapi-generator-sdk August 2, 2022 13:25
Comment on lines 212 to 215
time.sleep(2)
list_conferences_response = self.conference_api_instance.list_conferences(BW_ACCOUNT_ID, _return_http_data_only=False)

time.sleep(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the duplicate sleep?

Comment on lines 263 to 265
# Get Conference Information
"""Validate a Get Conference Information Request
"""
Copy link
Contributor

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):
Copy link

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?

elif get_call_response[0].state == 'complete':
callIdArray.remove(callId)
callIdArray.clear()
pass
Copy link

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.

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.

Nice work - removing ~100 lines of code from Test class - inheritance is worth trying if there is more commonality.

Comment on lines 5 to 29
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
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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

Comment on lines 47 to 53
# 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(
Copy link
Contributor

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

Copy link
Contributor Author

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):
Copy link
Contributor

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

Copy link
Contributor

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

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 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)
Copy link
Contributor

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

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 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

Comment on lines 218 to 230
# 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

More inconsistent comment spacing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be good now

Copy link
Contributor

@ajrice6713 ajrice6713 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 other than the imports spacing

Co-authored-by: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
@brianluisgomez brianluisgomez merged commit d257d1a into feature/openapi-generator-sdk Aug 8, 2022
@brianluisgomez brianluisgomez deleted the DX-2688 branch August 8, 2022 17:30
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