Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed May 29, 2023
1 parent b6f7354 commit efd2ae3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
- name: Generate coverage report
env:
SETTINGS_INI: ${{ secrets.SETTINGS_INI }}
SPOTIPY_CACHE: ${{ secrets.SPOTIPY_CACHE }}
run: |
pip install -e .
pip install coverage
cat <<< "$SETTINGS_INI" > spotify_to_ytmusic/settings.ini
cat <<< "$SPOTIPY_CACHE" > .cache
coverage run
coverage xml
- name: Upload coverage to Codecov
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ def test_setup(self):
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"
"builtins.input", side_effect=["3", "a", "b", "yes", ""]
), mock.patch(
"ytmusicapi.auth.oauth.YTMusicOAuth.get_token_from_code",
return_value=json.loads(Settings()["youtube"]["headers"]),
):
main()
assert tmp_path.is_file()
settings = Settings()
assert settings["spotify"]["client_id"] == "3"
assert settings["spotify"]["client_secret"] == "3"
assert settings["spotify"]["client_id"] == "a"
assert settings["spotify"]["client_secret"] == "b"
tmp_path.unlink()

with mock.patch("sys.argv", ["", "setup", "--file", example_path.as_posix()]), mock.patch(
Expand Down

0 comments on commit efd2ae3

Please sign in to comment.