Skip to content

Commit

Permalink
Add fixture for saving exiting config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dplocki committed Jan 9, 2024
1 parent e0cee15 commit d706689
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions e2e/test_sample.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
import os
import subprocess
import sys
import pytest


@pytest.fixture()
def secure_config_file():
home_directory = os.path.expanduser("~")
config_file_name = os.path.join(home_directory, ".podcast_downloader_config.json")
backup_config_file_name = os.path.join(home_directory, ".safe_copy_podcast_downloader_config.json")

if os.path.exists(config_file_name):
os.rename(config_file_name, backup_config_file_name)

yield config_file_name

if os.path.exists(backup_config_file_name):
os.remove(config_file_name)
os.rename(backup_config_file_name, config_file_name)


def build_server():
pass


def build_config():
pass
def build_config(config_path):
with open(config_path, 'w') as file:
file.write('''{
}''')


def run_podcast_downloader():
pass
subprocess.check_call([sys.executable, "-m", "podcast_downloader"])


def check_the_download_directory():
pass


def test_answer():
def test_answer(secure_config_file):
build_server()
build_config()
build_config(secure_config_file)

run_podcast_downloader()

Expand Down

0 comments on commit d706689

Please sign in to comment.