991010 Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
12- Do not edit the class manually.
12+ Do not edit the manually.
1313""" # noqa: E501
1414
1515
1616import unittest
17+ from datetime import date
1718
19+ from hamcrest import *
20+ from bandwidth import ApiClient , Configuration
1821from bandwidth .api .phone_number_lookup_api import PhoneNumberLookupApi
19-
22+ from bandwidth .models .async_lookup_request import AsyncLookupRequest
23+ from bandwidth .models .create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse
24+ from bandwidth .models .link_schema import LinkSchema
25+ from bandwidth .models .create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData
26+ from bandwidth .models .in_progress_lookup_status_enum import InProgressLookupStatusEnum
27+ from bandwidth .models .sync_lookup_request import SyncLookupRequest
28+ from bandwidth .models .create_sync_lookup_response import CreateSyncLookupResponse
29+ from bandwidth .models .completed_lookup_status_enum import CompletedLookupStatusEnum
30+ from bandwidth .models .lookup_result import LookupResult
31+ from bandwidth .models .line_type_enum import LineTypeEnum
32+ from bandwidth .models .latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum
33+ from bandwidth .models .get_async_bulk_lookup_response import GetAsyncBulkLookupResponse
34+
35+ from test .utils .env_variables import *
2036
2137class TestPhoneNumberLookupApi (unittest .TestCase ):
2238 """PhoneNumberLookupApi unit test stubs"""
2339
2440 def setUp (self ) -> None :
25- self .api = PhoneNumberLookupApi ()
41+ configuration = Configuration (
42+ username = BW_USERNAME ,
43+ password = BW_PASSWORD ,
44+ host = 'http://127.0.0.1:4010' ,
45+ ignore_operation_servers = True
46+ )
47+ api_client = ApiClient (configuration )
48+ self .api = PhoneNumberLookupApi (api_client )
2649
2750 def tearDown (self ) -> None :
2851 pass
@@ -32,22 +55,97 @@ def test_create_async_bulk_lookup(self) -> None:
3255
3356 Create Asynchronous Bulk Number Lookup
3457 """
35- pass
58+ request = AsyncLookupRequest (
59+ phone_numbers = [USER_NUMBER , BW_NUMBER ],
60+ )
61+
62+ response = self .api .create_async_bulk_lookup_with_http_info (BW_ACCOUNT_ID , request )
63+ assert_that (response , is_not (none ()))
64+ assert_that (response .status_code , equal_to (202 ))
65+ assert_that (response .data , is_not (none ()))
66+ assert_that (response .data , instance_of (CreateAsyncBulkLookupResponse ))
67+ assert_that (response .data .links , is_not (none ()))
68+ assert_that (response .data .links [0 ], instance_of (LinkSchema ))
69+ assert_that (response .data .links [0 ].rel , instance_of (str ))
70+ assert_that (response .data .links [0 ].href , instance_of (str ))
71+ assert_that (response .data .links [0 ].method , instance_of (str ))
72+ assert_that (response .data .data , is_not (none ()))
73+ assert_that (response .data .data , instance_of (CreateAsyncBulkLookupResponseData ))
74+ assert_that (response .data .data .request_id , instance_of (str ))
75+ assert_that (response .data .data .status , equal_to (InProgressLookupStatusEnum ('IN_PROGRESS' )))
76+ assert_that (response .data .errors , is_not (none ()))
77+ assert_that (response .data .errors , instance_of (list ))
3678
3779 def test_create_sync_lookup (self ) -> None :
3880 """Test case for create_sync_lookup
3981
4082 Create Synchronous Number Lookup
4183 """
42- pass
84+ request = SyncLookupRequest (
85+ phone_numbers = [USER_NUMBER , BW_NUMBER ],
86+ )
87+
88+ response = self .api .create_sync_lookup_with_http_info (BW_ACCOUNT_ID , request )
89+ assert_that (response , is_not (none ()))
90+ assert_that (response .status_code , equal_to (200 ))
91+ assert_that (response .data , is_not (none ()))
92+ assert_that (response .data , instance_of (CreateSyncLookupResponse ))
93+ assert_that (response .data .links , is_not (none ()))
94+ assert_that (response .data .links [0 ], instance_of (LinkSchema ))
95+ assert_that (response .data .links [0 ].rel , instance_of (str ))
96+ assert_that (response .data .links [0 ].href , instance_of (str ))
97+ assert_that (response .data .links [0 ].method , instance_of (str ))
98+ assert_that (response .data .data , is_not (none ()))
99+ assert_that (response .data .data .request_id , instance_of (str ))
100+ assert_that (response .data .data .status , instance_of (CompletedLookupStatusEnum ))
101+ assert_that (response .data .data .status , equal_to (CompletedLookupStatusEnum ('COMPLETE' )))
102+ assert_that (response .data .data .results , instance_of (list ))
103+ assert_that (response .data .data .results [0 ], instance_of (LookupResult ))
104+ assert_that (response .data .data .results [0 ].phone_number , instance_of (str ))
105+ assert_that (response .data .data .results [0 ].line_type , instance_of (LineTypeEnum ))
106+ assert_that (response .data .data .results [0 ].messaging_provider , instance_of (str ))
107+ assert_that (response .data .data .results [0 ].voice_provider , instance_of (str ))
108+ assert_that (response .data .data .results [0 ].country_code_a3 , instance_of (str ))
109+ assert_that (response .data .data .results [0 ].latest_message_delivery_status , instance_of (LatestMessageDeliveryStatusEnum ))
110+ assert_that (response .data .data .results [0 ].latest_message_delivery_status , equal_to (LatestMessageDeliveryStatusEnum ('ACTIVE' )))
111+ assert_that (response .data .data .results [0 ].initial_message_delivery_status_date , instance_of (date ))
112+ assert_that (response .data .data .results [0 ].latest_message_delivery_status_date , instance_of (date ))
113+ assert_that (response .data .errors , instance_of (list ))
114+
43115
44116 def test_get_async_bulk_lookup (self ) -> None :
45117 """Test case for get_async_bulk_lookup
46118
47119 Get Asynchronous Bulk Number Lookup
48120 """
49- pass
50-
121+ request_id = '123e4567-e89b-12d3-a456-426614174000'
122+
123+ response = self .api .get_async_bulk_lookup_with_http_info (BW_ACCOUNT_ID , request_id )
124+ assert_that (response , is_not (none ()))
125+ assert_that (response .status_code , equal_to (200 ))
126+ assert_that (response .data , is_not (none ()))
127+ assert_that (response .data , instance_of (GetAsyncBulkLookupResponse ))
128+ assert_that (response .data .links , is_not (none ()))
129+ assert_that (response .data .links [0 ], instance_of (LinkSchema ))
130+ assert_that (response .data .links [0 ].rel , instance_of (str ))
131+ assert_that (response .data .links [0 ].href , instance_of (str ))
132+ assert_that (response .data .links [0 ].method , instance_of (str ))
133+ assert_that (response .data .data , is_not (none ()))
134+ assert_that (response .data .data .request_id , instance_of (str ))
135+ assert_that (response .data .data .status , instance_of (InProgressLookupStatusEnum ))
136+ assert_that (response .data .data .status , equal_to (InProgressLookupStatusEnum ('COMPLETE' )))
137+ assert_that (response .data .data .results , instance_of (list ))
138+ assert_that (response .data .data .results [0 ], instance_of (LookupResult ))
139+ assert_that (response .data .data .results [0 ].phone_number , instance_of (str ))
140+ assert_that (response .data .data .results [0 ].line_type , instance_of (LineTypeEnum ))
141+ assert_that (response .data .data .results [0 ].messaging_provider , instance_of (str ))
142+ assert_that (response .data .data .results [0 ].voice_provider , instance_of (str ))
143+ assert_that (response .data .data .results [0 ].country_code_a3 , instance_of (str ))
144+ assert_that (response .data .data .results [0 ].latest_message_delivery_status , instance_of (LatestMessageDeliveryStatusEnum ))
145+ assert_that (response .data .data .results [0 ].latest_message_delivery_status , equal_to (LatestMessageDeliveryStatusEnum ('ACTIVE' )))
146+ assert_that (response .data .data .results [0 ].initial_message_delivery_status_date , instance_of (date ))
147+ assert_that (response .data .data .results [0 ].latest_message_delivery_status_date , instance_of (date ))
148+ assert_that (response .data .errors , instance_of (list ))
51149
52150if __name__ == '__main__' :
53151 unittest .main ()
0 commit comments