Skip to content

Commit

Permalink
Make the tests pass when git is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mitya57 authored and waylan committed May 23, 2018
1 parent 7dbcf9a commit 3f0e446
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mkdocs/tests/gh_deploy_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def test_get_remote_url_enterprise(self, mock_popeno):
@mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True)
@mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas')
@mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None))
@mock.patch('mkdocs.commands.gh_deploy._check_version')
@mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, ''))
def test_deploy(self, mock_import, get_remote, get_sha, is_repo):
def test_deploy(self, mock_import, check_version, get_remote, get_sha, is_repo):

config = load_config(
remote_branch='test',
Expand All @@ -78,9 +79,10 @@ def test_deploy(self, mock_import, get_remote, get_sha, is_repo):
@mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True)
@mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas')
@mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(None, None))
@mock.patch('mkdocs.commands.gh_deploy._check_version')
@mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, ''))
@mock.patch('os.path.isfile', return_value=False)
def test_deploy_no_cname(self, mock_isfile, mock_import, get_remote,
def test_deploy_no_cname(self, mock_isfile, mock_import, check_version, get_remote,
get_sha, is_repo):

config = load_config(
Expand All @@ -92,8 +94,9 @@ def test_deploy_no_cname(self, mock_isfile, mock_import, get_remote,
@mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas')
@mock.patch('mkdocs.commands.gh_deploy._get_remote_url', return_value=(
u'git@', u'mkdocs/mkdocs.git'))
@mock.patch('mkdocs.commands.gh_deploy._check_version')
@mock.patch('mkdocs.commands.gh_deploy.ghp_import.ghp_import', return_value=(True, ''))
def test_deploy_hostname(self, mock_import, get_remote, get_sha, is_repo):
def test_deploy_hostname(self, mock_import, check_version, get_remote, get_sha, is_repo):

config = load_config(
remote_branch='test',
Expand Down Expand Up @@ -126,9 +129,12 @@ def test_deploy_ignore_version(self, mock_import, check_version, get_remote, get
gh_deploy.gh_deploy(config, ignore_version=True)
check_version.assert_not_called()

@mock.patch('mkdocs.commands.gh_deploy._is_cwd_git_repo', return_value=True)
@mock.patch('mkdocs.commands.gh_deploy._get_current_sha', return_value='shashas')
@mock.patch('mkdocs.commands.gh_deploy._check_version')
@mock.patch('mkdocs.utils.ghp_import.ghp_import')
@mock.patch('mkdocs.commands.gh_deploy.log')
def test_deploy_error(self, mock_log, mock_import):
def test_deploy_error(self, mock_log, mock_import, check_version, get_sha, is_repo):
error_string = 'TestError123'
mock_import.return_value = (False, error_string)

Expand Down

0 comments on commit 3f0e446

Please sign in to comment.