Skip to content

Commit 8df737a

Browse files
ckoegelajrice6713
andauthored
DX-2691 messages_api Integration Tests (#91)
* First commit with updated sdk and tests * more updates to sdk and tests * more test and spec updates * update test afer fielderror additon * update to use specific 401 exception * Apply suggestions from code review Co-authored-by: AJ Rice <[email protected]> * remove duplicate account_id * updates based on comments * log message time * remove logging and drop 3.6 for testing * use json body instead of models for errors * update tests based on comments * Update test/integration/test_messages_api.py * remove unnecessary typing Co-authored-by: AJ Rice <[email protected]>
1 parent 9aaa6fe commit 8df737a

File tree

16 files changed

+864
-39
lines changed

16 files changed

+864
-39
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [windows-2022, windows-2019, ubuntu-18.04, ubuntu-20.04]
16-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
16+
python-version: [3.7, 3.8, 3.9, '3.10']
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2

.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ bandwidth/model/conference_state_enum.py
3535
bandwidth/model/create_call.py
3636
bandwidth/model/create_call_response.py
3737
bandwidth/model/create_lookup_response.py
38+
bandwidth/model/create_message_request_error.py
3839
bandwidth/model/create_participant_request.py
3940
bandwidth/model/create_participant_response.py
4041
bandwidth/model/deferred_result.py
4142
bandwidth/model/device_api_version_enum.py
4243
bandwidth/model/diversion.py
44+
bandwidth/model/field_error.py
4345
bandwidth/model/file_format_enum.py
4446
bandwidth/model/forbidden_request.py
4547
bandwidth/model/list_message_direction_enum.py
@@ -108,11 +110,13 @@ docs/ConferencesApi.md
108110
docs/CreateCall.md
109111
docs/CreateCallResponse.md
110112
docs/CreateLookupResponse.md
113+
docs/CreateMessageRequestError.md
111114
docs/CreateParticipantRequest.md
112115
docs/CreateParticipantResponse.md
113116
docs/DeferredResult.md
114117
docs/DeviceApiVersionEnum.md
115118
docs/Diversion.md
119+
docs/FieldError.md
116120
docs/FileFormatEnum.md
117121
docs/ForbiddenRequest.md
118122
docs/ListMessageDirectionEnum.md
@@ -192,11 +196,13 @@ test/test_conferences_api.py
192196
test/test_create_call.py
193197
test/test_create_call_response.py
194198
test/test_create_lookup_response.py
199+
test/test_create_message_request_error.py
195200
test/test_create_participant_request.py
196201
test/test_create_participant_response.py
197202
test/test_deferred_result.py
198203
test/test_device_api_version_enum.py
199204
test/test_diversion.py
205+
test/test_field_error.py
200206
test/test_file_format_enum.py
201207
test/test_forbidden_request.py
202208
test/test_list_message_direction_enum.py

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ Class | Method | HTTP request | Description
197197
- [CreateCall](docs/CreateCall.md)
198198
- [CreateCallResponse](docs/CreateCallResponse.md)
199199
- [CreateLookupResponse](docs/CreateLookupResponse.md)
200+
- [CreateMessageRequestError](docs/CreateMessageRequestError.md)
200201
- [CreateParticipantRequest](docs/CreateParticipantRequest.md)
201202
- [CreateParticipantResponse](docs/CreateParticipantResponse.md)
202203
- [DeferredResult](docs/DeferredResult.md)
203204
- [DeviceApiVersionEnum](docs/DeviceApiVersionEnum.md)
204205
- [Diversion](docs/Diversion.md)
206+
- [FieldError](docs/FieldError.md)
205207
- [FileFormatEnum](docs/FileFormatEnum.md)
206208
- [ForbiddenRequest](docs/ForbiddenRequest.md)
207209
- [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md)

bandwidth.json

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,10 +2431,10 @@
24312431
"type": "string",
24322432
"description": "The priority specified by the user.",
24332433
"enum": [
2434-
"DEFAULT",
2435-
"HIGH"
2434+
"default",
2435+
"high"
24362436
],
2437-
"example": "DEFAULT"
2437+
"example": "default"
24382438
},
24392439
"messageStatusEnum": {
24402440
"type": "string",
@@ -2476,6 +2476,21 @@
24762476
],
24772477
"example": "sms"
24782478
},
2479+
"fieldError": {
2480+
"type": "object",
2481+
"properties": {
2482+
"fieldName": {
2483+
"type": "string",
2484+
"description": "The name of the field that contains the error",
2485+
"example": "from"
2486+
},
2487+
"description": {
2488+
"type": "string",
2489+
"description": "The error associated with the field",
2490+
"example": "'+invalid' must be replaced with a valid E164 formatted telephone number"
2491+
}
2492+
}
2493+
},
24792494
"messagesList": {
24802495
"title": "MessagesList",
24812496
"type": "object",
@@ -2547,11 +2562,13 @@
25472562
"carrierName": {
25482563
"type": "string",
25492564
"description": "The name of the carrier. Not currently supported for MMS coming soon.",
2565+
"nullable": true,
25502566
"example": "other"
25512567
},
25522568
"messageSize": {
25532569
"type": "integer",
25542570
"description": "The size of the message including message content and headers.",
2571+
"nullable": true,
25552572
"example": 27
25562573
},
25572574
"messageLength": {
@@ -2562,16 +2579,19 @@
25622579
"attachmentCount": {
25632580
"type": "integer",
25642581
"description": "The number of attachments the message has.",
2582+
"nullable": true,
25652583
"example": 1
25662584
},
25672585
"recipientCount": {
25682586
"type": "integer",
25692587
"description": "The number of recipients the message has.",
2588+
"nullable": true,
25702589
"example": 1
25712590
},
25722591
"campaignClass": {
25732592
"type": "string",
25742593
"description": "The campaign class of the message if it has one.",
2594+
"nullable": true,
25752595
"example": "T"
25762596
}
25772597
}
@@ -2618,6 +2638,29 @@
26182638
"description"
26192639
]
26202640
},
2641+
"createMessageRequestError": {
2642+
"title": "CreateMessageRequestError",
2643+
"type": "object",
2644+
"properties": {
2645+
"type": {
2646+
"type": "string"
2647+
},
2648+
"description": {
2649+
"type": "string"
2650+
},
2651+
"fieldErrors": {
2652+
"type": "array",
2653+
"items": {
2654+
"$ref": "#/components/schemas/fieldError"
2655+
}
2656+
}
2657+
},
2658+
"required": [
2659+
"type",
2660+
"description"
2661+
],
2662+
"additionalProperties": true
2663+
},
26212664
"media": {
26222665
"title": "Media",
26232666
"type": "object",
@@ -4541,6 +4584,16 @@
45414584
}
45424585
}
45434586
},
4587+
"createMessageBadRequestError": {
4588+
"description": "Bad Request",
4589+
"content": {
4590+
"application/json": {
4591+
"schema": {
4592+
"$ref": "#/components/schemas/createMessageRequestError"
4593+
}
4594+
}
4595+
}
4596+
},
45444597
"messagingUnauthorizedError": {
45454598
"description": "Unauthorized",
45464599
"content": {
@@ -5338,7 +5391,7 @@
53385391
"required": false,
53395392
"description": "The direction of the message. One of INBOUND OUTBOUND.",
53405393
"schema": {
5341-
"$ref": "#/components/schemas/messageDirectionEnum"
5394+
"$ref": "#/components/schemas/listMessageDirectionEnum"
53425395
}
53435396
},
53445397
"carrierName": {

bandwidth/api/messages_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
none_type,
2323
validate_and_convert_types
2424
)
25+
from bandwidth.model.list_message_direction_enum import ListMessageDirectionEnum
2526
from bandwidth.model.message import Message
26-
from bandwidth.model.message_direction_enum import MessageDirectionEnum
2727
from bandwidth.model.message_request import MessageRequest
2828
from bandwidth.model.message_status_enum import MessageStatusEnum
2929
from bandwidth.model.message_type_enum import MessageTypeEnum
@@ -165,7 +165,7 @@ def __init__(self, api_client=None):
165165
'message_status':
166166
(MessageStatusEnum,),
167167
'message_direction':
168-
(MessageDirectionEnum,),
168+
(ListMessageDirectionEnum,),
169169
'carrier_name':
170170
(str,),
171171
'message_type':
@@ -336,7 +336,7 @@ def list_messages(
336336
source_tn (str): The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').. [optional]
337337
destination_tn (str): The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').. [optional]
338338
message_status (MessageStatusEnum): The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED.. [optional]
339-
message_direction (MessageDirectionEnum): The direction of the message. One of INBOUND OUTBOUND.. [optional]
339+
message_direction (ListMessageDirectionEnum): The direction of the message. One of INBOUND OUTBOUND.. [optional]
340340
carrier_name (str): The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T).. [optional]
341341
message_type (MessageTypeEnum): The type of message. Either sms or mms.. [optional]
342342
error_code (int): The error code of the message.. [optional]

0 commit comments

Comments
 (0)