コード例 #1
0
 def test_get_org_commit_fail(self):
     mock = MagicMock()
     mock_repo = MagicMock()
     mock_org = MagicMock()
     mock_repo.get_commit.side_effect = GithubException(404, "Not Found")
     mock_org.get_repo.return_value = mock_repo
     mock.get_organization.return_value = mock_org
     client = SourceControlClient(mock, mock, mock)
     org_commit = client.get_organisation_commit("tribe-called-quest", "midnight-marauders", "yahyah")
     self.assertFalse(org_commit)
コード例 #2
0
 def test_get_org_commit(self):
     mock = MagicMock()
     mock_commit = MagicMock()
     mock_repo = MagicMock()
     mock_org = MagicMock()
     commit_sha = "123shasha"
     mock_commit.sha = commit_sha
     mock_repo.get_commit.return_value = mock_commit
     mock_org.get_repo.return_value = mock_repo
     mock.get_organization.return_value = mock_org
     client = SourceControlClient(mock, mock, mock)
     org_commit = client.get_organisation_commit("tribe-called-quest", "midnight-marauders", commit_sha)
     self.assertEqual(org_commit.sha, commit_sha)