Skip to content

Commit

Permalink
Add sleep to Media Tests (#99)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ajrice6713 authored Aug 2, 2022
1 parent ceb123b commit 2c6e376
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/integration/test_media_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import uuid
import filecmp
import unittest

Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit 2c6e376

Please sign in to comment.