Skip to content

Commit d8109e8

Browse files
authored
DX-2691 Add TN Lookup Integration Tests (#92)
* Begin integration tests Bad lookup status response model related to the oas definition changed the definition and regenerated the spec * Regenerate so that createLookupResponse returns enum for status * Finalize Integration tests for phoneNumberLookup API * Improve tests Remove unused tearDown function Add a verizon (non-bw) number add stronger logic to test order status add regex testing for uuid test each lookup result field for type and data (where possible) add tests for 401 and 403 responses * Update test.yaml new requirements filename * Update test.yaml * Update test.yaml Load secrets as envs * Add python 3.10 to matrix testing * Add tests for AT&T and T-Mobile Tns * missed env variables in new tests * Reusable `validateResult` function * Move the polling logic into a separate function * Create `validateAuthException` helper function * Missed asserting anything in testDuplicatePhoneNumberLookup * PEP8 Formatting * Add function docstrings * Change validateAuthException name Use assertAuthException to match unittest assert names * Document function return types
1 parent 21c4a0a commit d8109e8

File tree

12 files changed

+631
-64
lines changed

12 files changed

+631
-64
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ __pycache__/
66
# C extensions
77
*.so
88

9+
# MacOS Files
10+
.DS_Store
11+
912
# Distribution / packaging
1013
.Python
1114
env/

.openapi-generator/FILES

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ bandwidth/model/forbidden_request.py
4545
bandwidth/model/list_message_direction_enum.py
4646
bandwidth/model/list_message_item.py
4747
bandwidth/model/lookup_request.py
48+
bandwidth/model/lookup_result.py
4849
bandwidth/model/lookup_status.py
4950
bandwidth/model/lookup_status_enum.py
50-
bandwidth/model/lookup_status_result_inner.py
5151
bandwidth/model/machine_detection_configuration.py
5252
bandwidth/model/machine_detection_mode_enum.py
5353
bandwidth/model/media.py
@@ -118,9 +118,9 @@ docs/ForbiddenRequest.md
118118
docs/ListMessageDirectionEnum.md
119119
docs/ListMessageItem.md
120120
docs/LookupRequest.md
121+
docs/LookupResult.md
121122
docs/LookupStatus.md
122123
docs/LookupStatusEnum.md
123-
docs/LookupStatusResultInner.md
124124
docs/MFAApi.md
125125
docs/MachineDetectionConfiguration.md
126126
docs/MachineDetectionModeEnum.md
@@ -202,9 +202,9 @@ test/test_forbidden_request.py
202202
test/test_list_message_direction_enum.py
203203
test/test_list_message_item.py
204204
test/test_lookup_request.py
205+
test/test_lookup_result.py
205206
test/test_lookup_status.py
206207
test/test_lookup_status_enum.py
207-
test/test_lookup_status_result_inner.py
208208
test/test_machine_detection_configuration.py
209209
test/test_machine_detection_mode_enum.py
210210
test/test_media.py

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ Class | Method | HTTP request | Description
207207
- [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md)
208208
- [ListMessageItem](docs/ListMessageItem.md)
209209
- [LookupRequest](docs/LookupRequest.md)
210+
- [LookupResult](docs/LookupResult.md)
210211
- [LookupStatus](docs/LookupStatus.md)
211212
- [LookupStatusEnum](docs/LookupStatusEnum.md)
212-
- [LookupStatusResultInner](docs/LookupStatusResultInner.md)
213213
- [MachineDetectionConfiguration](docs/MachineDetectionConfiguration.md)
214214
- [MachineDetectionModeEnum](docs/MachineDetectionModeEnum.md)
215215
- [Media](docs/Media.md)

bandwidth.json

Lines changed: 53 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,7 +4156,58 @@
41564156
"type": "string"
41574157
},
41584158
"status": {
4159-
"type": "string"
4159+
"$ref": "#/components/schemas/lookupStatusEnum"
4160+
}
4161+
}
4162+
},
4163+
"lookupResult": {
4164+
"type": "object",
4165+
"description": "Carrier information results for the specified telephone number.",
4166+
"properties": {
4167+
"Response Code": {
4168+
"type": "integer",
4169+
"description": "Our vendor's response code.",
4170+
"example": 0
4171+
},
4172+
"Message": {
4173+
"type": "string",
4174+
"description": "Message associated with the response code.",
4175+
"example": "NOERROR"
4176+
},
4177+
"E.164 Format": {
4178+
"type": "string",
4179+
"description": "The telephone number in E.164 format.",
4180+
"example": "+19195551234"
4181+
},
4182+
"Formatted": {
4183+
"type": "string",
4184+
"description": "The formatted version of the telephone number.",
4185+
"example": "(919) 555-1234"
4186+
},
4187+
"Country": {
4188+
"type": "string",
4189+
"description": "The country of the telephone number.",
4190+
"example": "US"
4191+
},
4192+
"Line Type": {
4193+
"type": "string",
4194+
"description": "The line type of the telephone number.",
4195+
"example": "Mobile"
4196+
},
4197+
"Line Provider": {
4198+
"type": "string",
4199+
"description": "The messaging service provider of the telephone number.",
4200+
"example": "Verizon Wireless"
4201+
},
4202+
"Mobile Country Code": {
4203+
"type": "string",
4204+
"description": "The first half of the Home Network Identity (HNI).",
4205+
"example": "310"
4206+
},
4207+
"Mobile Network Code": {
4208+
"type": "string",
4209+
"description": "The second half of the HNI.",
4210+
"example": "010"
41604211
}
41614212
}
41624213
},
@@ -4176,54 +4227,7 @@
41764227
"type": "array",
41774228
"description": "The carrier information results for the specified telephone number.",
41784229
"items": {
4179-
"type": "object",
4180-
"properties": {
4181-
"Response Code": {
4182-
"type": "integer",
4183-
"description": "Our vendor's response code.",
4184-
"example": 0
4185-
},
4186-
"Message": {
4187-
"type": "string",
4188-
"description": "Message associated with the response code.",
4189-
"example": "NOERROR"
4190-
},
4191-
"E.164 Format": {
4192-
"type": "string",
4193-
"description": "The telephone number in E.164 format.",
4194-
"example": "+19195551234"
4195-
},
4196-
"Formatted": {
4197-
"type": "string",
4198-
"description": "The formatted version of the telephone number.",
4199-
"example": "(919) 555-1234"
4200-
},
4201-
"Country": {
4202-
"type": "string",
4203-
"description": "The country of the telephone number.",
4204-
"example": "US"
4205-
},
4206-
"Line Type": {
4207-
"type": "string",
4208-
"description": "The line type of the telephone number.",
4209-
"example": "Mobile"
4210-
},
4211-
"Line Provider": {
4212-
"type": "string",
4213-
"description": "The messaging service provider of the telephone number.",
4214-
"example": "Verizon Wireless"
4215-
},
4216-
"Mobile Country Code": {
4217-
"type": "string",
4218-
"description": "The first half of the Home Network Identity (HNI).",
4219-
"example": "310"
4220-
},
4221-
"Mobile Network Code": {
4222-
"type": "string",
4223-
"description": "The second half of the HNI.",
4224-
"example": "010"
4225-
}
4226-
}
4230+
"$ref": "#/components/schemas/lookupResult"
42274231
}
42284232
},
42294233
"failedTelephoneNumbers": {

bandwidth/model/create_lookup_response.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
from bandwidth.exceptions import ApiAttributeError
3131

3232

33+
def lazy_import():
34+
from bandwidth.model.lookup_status_enum import LookupStatusEnum
35+
globals()['LookupStatusEnum'] = LookupStatusEnum
36+
3337

3438
class CreateLookupResponse(ModelNormal):
3539
"""NOTE: This class is auto generated by OpenAPI Generator.
@@ -67,6 +71,7 @@ def additional_properties_type():
6771
This must be a method because a model may have properties that are
6872
of type self, this must run after the class is loaded
6973
"""
74+
lazy_import()
7075
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
7176

7277
_nullable = False
@@ -81,9 +86,10 @@ def openapi_types():
8186
openapi_types (dict): The key is attribute name
8287
and the value is attribute type.
8388
"""
89+
lazy_import()
8490
return {
8591
'request_id': (str,), # noqa: E501
86-
'status': (str,), # noqa: E501
92+
'status': (LookupStatusEnum,), # noqa: E501
8793
}
8894

8995
@cached_property
@@ -138,7 +144,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
138144
through its discriminator because we passed in
139145
_visited_composed_classes = (Animal,)
140146
request_id (str): [optional] # noqa: E501
141-
status (str): [optional] # noqa: E501
147+
status (LookupStatusEnum): [optional] # noqa: E501
142148
"""
143149

144150
_check_type = kwargs.pop('_check_type', True)
@@ -225,7 +231,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
225231
through its discriminator because we passed in
226232
_visited_composed_classes = (Animal,)
227233
request_id (str): [optional] # noqa: E501
228-
status (str): [optional] # noqa: E501
234+
status (LookupStatusEnum): [optional] # noqa: E501
229235
"""
230236

231237
_check_type = kwargs.pop('_check_type', True)

0 commit comments

Comments
 (0)