Skip to content

Commit

Permalink
Use non-static path for downloading CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusselsmark committed Feb 9, 2025
1 parent eccc9f7 commit 30c61aa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions members/tests/test_functional/test_admin_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def setUp(self):
self.union1.secretary = self.person4
self.union1.save()

self.download_dir = "/app/test-files"
self.download_dir = os.path.join(os.getcwd(), "test-files")
print(f"Download dir: {self.download_dir}")
if not os.path.exists(self.download_dir):
os.mkdir(self.download_dir)

Expand Down Expand Up @@ -253,15 +254,15 @@ def test_admin_filter_and_search(self):
self.save_screenshot_and_html("export_union_info")

# Wait for the file to be downloaded
timeout = 20
timeout = 5
while timeout > 0:
if os.path.exists(csv_file_path):
break
time.sleep(1)
timeout -= 1

# Verify the CSV content
self.assertTrue(os.path.exists(csv_file_path), "CSV file was not downloaded")
self.assertTrue(os.path.exists(csv_file_path), f"'{csv_file_path}' file was not downloaded")

with open(csv_file_path, newline="", encoding="utf-8-sig") as csvfile:
csv_reader = csv.reader(csvfile, delimiter=";")
Expand Down

0 comments on commit 30c61aa

Please sign in to comment.