Skip to content

Commit

Permalink
Issue #364: Mock git_machete.github.__get_github_token inside test_gi…
Browse files Browse the repository at this point in the history
…thub_create_pr_missing_base_branch_on_remote (#431)
  • Loading branch information
amalota authored Feb 14, 2022
1 parent 9b1cfc2 commit d47818c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions git_machete/tests/functional/test_machete.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def mock_ask_if(*args: str, **kwargs: Any) -> str:
return 'y'


def mock__get_github_token() -> Optional[str]:
return None


class FakeCommandLineOptions(CommandLineOptions):
def __init__(self) -> None:
super().__init__()
Expand Down Expand Up @@ -2161,6 +2165,7 @@ def test_github_create_pr(self) -> None:

# We need to mock GITHUB_REMOTE_PATTERNS in the tests for `test_github_create_pr` due to `git fetch` executed by `create-pr` subcommand.
@mock.patch('git_machete.github.GITHUB_REMOTE_PATTERNS', FAKE_GITHUB_REMOTE_PATTERNS)
@mock.patch('git_machete.github.__get_github_token', mock__get_github_token)
@mock.patch('git_machete.utils.run_cmd', mock_run_cmd) # to hide git outputs in tests
@mock.patch('git_machete.options.CommandLineOptions', FakeCommandLineOptions)
@mock.patch('git_machete.client.MacheteClient.ask_if', mock_ask_if)
Expand Down

0 comments on commit d47818c

Please sign in to comment.