Skip to content

Commit

Permalink
fix setup (closes #50)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Apr 18, 2023
1 parent d5d5f64 commit 3bd1b2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions spotify_to_ytmusic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def setup(file: Optional[Path] = None):
setup_file(file)
return

if not Settings.filepath.is_file():
shutil.copy(Settings.filepath.with_suffix(".ini.example"), Settings.filepath)
choice = input("Choose which API to set up\n" "(1) Spotify\n" "(2) YouTube\n" "(3) both\n")
choices = ["1", "2", "3"]
if choice not in choices:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def test_setup(self):
tmp_path = Path(__file__).parent.joinpath("settings.tmp")
example_path = Settings.filepath.parent.joinpath("settings.ini.example")
shutil.copy(example_path, tmp_path)
with mock.patch("sys.argv", ["", "setup"]), mock.patch(
"builtins.input", return_value="3"
), mock.patch("spotify_to_ytmusic.settings.Settings.filepath", tmp_path):
with mock.patch("sys.argv", ["", "setup"]), mock.patch("builtins.input", return_value="3"):
main()
assert tmp_path.is_file()
tmp_path.unlink()
Expand Down

0 comments on commit 3bd1b2c

Please sign in to comment.