def test_check_project_checks_projects(): project = Mock() check_project(project, skip_checks=[], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert project.check_remotes.called assert project.check_uncommitted_changes.called assert project.check_git_stash.called print(project.check_for_file.call_args) assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list
def test_check_projects_unpushed_commits(): project = Mock() project.get_remotes.return_value = [] check_project(project, skip_checks=[], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called project.reset_mock() project.get_remotes.return_value = [] check_project(project, skip_checks=[], ignore_unpushed_if_no_remotes=True) assert not project.check_unpushed_commits.called project.reset_mock() project.get_remotes.return_value = ["fakeremote"] check_project(project, skip_checks=[], ignore_unpushed_if_no_remotes=True) assert project.check_unpushed_commits.called project.reset_mock() project.get_remotes.return_value = ["fakeremote"] check_project(project, skip_checks=["ignore_unpushed_commits"], ignore_unpushed_if_no_remotes=True) assert not project.check_unpushed_commits.called
def test_check_projects_skips_checks(): project = Mock() check_project(project, skip_checks=["ignore_unpushed_commits"], ignore_unpushed_if_no_remotes=False) assert not project.check_unpushed_commits.called assert project.check_remotes.called assert project.check_uncommitted_changes.called assert project.check_git_stash.called assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list project.reset_mock() check_project(project, skip_checks=["ignore_remotes"], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert not project.check_remotes.called assert project.check_uncommitted_changes.called assert project.check_git_stash.called assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list project.reset_mock() check_project(project, skip_checks=["ignore_uncommitted_changes"], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert project.check_remotes.called assert not project.check_uncommitted_changes.called assert project.check_git_stash.called assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list project.reset_mock() check_project(project, skip_checks=["ignore_stash"], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert project.check_remotes.called assert project.check_uncommitted_changes.called assert not project.check_git_stash.called assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list project.reset_mock() check_project(project, skip_checks=["ignore_missing_license"], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert project.check_remotes.called assert project.check_uncommitted_changes.called assert project.check_git_stash.called assert call("LICENSE") not in project.check_for_nonempty_file.call_args_list assert call("README") in project.check_for_nonempty_file.call_args_list project.reset_mock() check_project(project, skip_checks=["ignore_missing_readme"], ignore_unpushed_if_no_remotes=False) assert project.check_unpushed_commits.called assert project.check_remotes.called assert project.check_uncommitted_changes.called assert project.check_git_stash.called assert call("LICENSE") in project.check_for_nonempty_file.call_args_list assert call("README") not in project.check_for_nonempty_file.call_args_list