From 2c6e3767fb2840bd3d7b96255d5b98114a048c0b Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Tue, 2 Aug 2022 11:40:14 -0400 Subject: [PATCH] Add sleep to Media Tests (#99) * Add sleep to Media Tests * Bump time.sleep to 5 Clean up docstrings f string formatting for exception * Remove unneeded exception handling * Print for logging * More logging * Move log statement * Add UUID to media name GHA uses `linux` for each ubuntu version - so the media IDs arent unique --- test/integration/test_media_api.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/integration/test_media_api.py b/test/integration/test_media_api.py index 4ce1d6ca..f69497dd 100644 --- a/test/integration/test_media_api.py +++ b/test/integration/test_media_api.py @@ -3,6 +3,7 @@ """ import os +import uuid import filecmp import unittest @@ -26,7 +27,7 @@ def setUp(self) -> None: self.account_id = os.environ['BW_ACCOUNT_ID'] self.media_path = "./test/fixtures/" self.media_file = "python_cat.jpeg" - self.media_id = os.environ['PYTHON_VERSION'] + "_" + os.environ['RUNNER_OS'] + "_" + os.environ['GITHUB_RUN_ID'] + "_" + self.media_file + self.media_id = os.environ['PYTHON_VERSION'] + "_" + os.environ['RUNNER_OS'] + "_" + str(uuid.uuid4()) + "_" + self.media_file self.download_file_path = "cat_download.jpeg" self.original_file = open(self.media_path + self.media_file, "rb") @@ -77,7 +78,7 @@ def listMedia(self) -> None: pass def getMedia(self) -> None: - """Test downloading the media we uploaded in step 1 + """Test downloading the media we previously uploaded """ api_response_with_http_info = self.api_instance.get_media( self.account_id, self.media_id, _return_http_data_only=False) @@ -95,7 +96,7 @@ def getMedia(self) -> None: download_file.close() def deleteMedia(self) -> None: - """Test deleting the media that was uploaded in step 1 + """Test deleting the media that we previously uploaded """ api_response_with_http_info = self.api_instance.delete_media( self.account_id, self.media_id, _return_http_data_only=False) @@ -114,10 +115,7 @@ def test_steps(self) -> None: """Test each function from _steps.call_order in specified order """ for name, step in self._steps(): - try: - step() - except ApiException as e: - self.fail("{} failed ({}: {})".format(step, type(e), e)) + step() @unittest.skip("API does not support url encoded characters in path") def testGetMediaWithBandwidthId(self) -> None: