diff --git a/github/MainClass.py b/github/MainClass.py index 5030bb6a..b2a806d7 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -790,7 +790,7 @@ class GithubIntegration(object): } response = requests.get( - "{}/repos/{}/{}/installation".format(DEFAULT_BASE_URL, owner, repo), + "{}/repos/{}/{}/installation".format(self.base_url, owner, repo), headers=headers ) response_dict = response.json() diff --git a/tests/GithubIntegration.py b/tests/GithubIntegration.py index e8c1f85a..007cc105 100644 --- a/tests/GithubIntegration.py +++ b/tests/GithubIntegration.py @@ -84,6 +84,7 @@ class GithubIntegration(unittest.TestCase): def __init__(self): self.args = tuple() self.kwargs = dict() + self.calls = [] @property def status_code(self): @@ -120,6 +121,7 @@ class GithubIntegration(unittest.TestCase): ) def __call__(self, *args, **kwargs): + self.calls.append((args, kwargs)) self.args = args self.kwargs = kwargs return self @@ -167,9 +169,18 @@ class GithubIntegration(unittest.TestCase): integr = GithubIntegration("11111", private_key) inst = integr.get_installation("foo", "bar") self.assertEqual( - inst.id.value, - 111111 - ) + self.get_mock.calls[0][0], + ('https://api.github.com/repos/foo/bar/installation',)) + self.assertEqual(inst.id.value, 111111) + + def test_get_installation_custom_base_url(self): + from github import GithubIntegration + integr = GithubIntegration("11111", private_key, base_url='https://corp.com/v3') + inst = integr.get_installation("foo", "bar") + self.assertEqual( + self.get_mock.calls[0][0], + ('https://corp.com/v3/repos/foo/bar/installation',)) + self.assertEqual(inst.id.value, 111111) def tearDown(self): GithubObject.setCheckAfterInitFlag(self.origin_check_after_init_flag)