def test_returns_None_if_git_not_found(self): call_and_check = self.patch(shell, "call_and_check") call_and_check.side_effect = FileNotFoundError() self.assertIsNone(version._get_maas_repo_hash())
def test_returns_hash_for_this_branch(self): commit_hash = version._get_maas_repo_hash() self.assertIsInstance(commit_hash, str)
def test_returns_None_if_git_crashes(self): call_and_check = self.patch(shell, "call_and_check") call_and_check.side_effect = shell.ExternalProcessError(2, "cmd") self.assertIsNone(version._get_maas_repo_hash())