Skip to content

Commit 4f433f6

Browse files
committed
Refactor TestEndpointsApi setup to use client_id and client_secret; remove forbidden credentials test
1 parent 740f4e7 commit 4f433f6

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

test/smoke/test_endpoints_api.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,15 @@ class TestEndpointsApi(unittest.TestCase):
2525
@classmethod
2626
def setUpClass(cls) -> None:
2727
configuration = Configuration(
28-
username=BW_USERNAME,
29-
password=BW_PASSWORD
28+
client_id=BW_CLIENT_ID,
29+
client_secret=BW_CLIENT_SECRET
3030
)
3131
api_client = ApiClient(configuration)
3232
cls.endpoints_api_instance = EndpointsApi(api_client)
3333

3434
# Unauthorized API Client
35-
unauthorized_configuration = Configuration(
36-
username='bad_username',
37-
password='bad_password'
38-
)
39-
unauthorized_api_client = ApiClient(unauthorized_configuration)
40-
cls.unauthorized_api_instance = EndpointsApi(unauthorized_api_client)
41-
42-
# Forbidden API Client
43-
forbidden_configuration = Configuration(
44-
username=FORBIDDEN_USERNAME,
45-
password=FORBIDDEN_PASSWORD
46-
)
47-
forbidden_api_client = ApiClient(forbidden_configuration)
48-
cls.forbidden_api_instance = EndpointsApi(forbidden_api_client)
35+
cls.unauthorized_api_client = ApiClient()
36+
cls.unauthorized_api_instance = EndpointsApi(cls.unauthorized_api_client)
4937

5038
cls.account_id = BW_ACCOUNT_ID
5139
cls.endpoint_id_array = []
@@ -268,23 +256,6 @@ def test_create_endpoint_unauthorized(self):
268256

269257
assert_that(context.exception.status, equal_to(401))
270258

271-
def test_create_endpoint_forbidden(self):
272-
"""Test creating an endpoint with forbidden credentials returns 403"""
273-
time.sleep(self.TEST_SLEEP)
274-
275-
create_request = CreateWebRtcConnectionRequest(
276-
type=EndpointTypeEnum.WEBRTC,
277-
direction=EndpointDirectionEnum.BIDIRECTIONAL
278-
)
279-
280-
with self.assertRaises(ApiException) as context:
281-
self.forbidden_api_instance.create_endpoint(
282-
self.account_id,
283-
create_request
284-
)
285-
286-
assert_that(context.exception.status, equal_to(403))
287-
288259

289260
if __name__ == '__main__':
290261
unittest.main()

0 commit comments

Comments
 (0)