web: fix connections list github base_url

The toDict() method of the github connection should use base_url instead
of baseurl to prevent an AttributeError exception being through as
baseurl doesn't exists in the GithubConnection object.

Change-Id: I2fa7a2bfde781371816da533530beb81c188bc9c
This commit is contained in:
Tristan Cacqueray 2019-08-27 19:41:49 +00:00
parent 2ae6dc3bc6
commit 1da06b4089
2 changed files with 24 additions and 1 deletions

View File

@ -1539,3 +1539,26 @@ class TestTenantScopedWebApiWithAuthRules(BaseTestWeb):
json=change)
self.assertEqual(200, req.status_code, req.text)
self.waitUntilSettled()
class TestWebMulti(BaseTestWeb):
config_file = 'zuul-gerrit-github.conf'
def test_web_connections_list_multi(self):
data = self.get_url('api/connections').json()
gerrit_connection = {
'driver': 'gerrit',
'name': 'gerrit',
'baseurl': 'https://review.example.com',
'canonical_hostname': 'review.example.com',
'server': 'review.example.com',
'port': 29418,
}
github_connection = {
'baseurl': 'https://api.github.com',
'canonical_hostname': 'github.com',
'driver': 'github',
'name': 'github',
'server': 'github.com',
}
self.assertEqual([gerrit_connection, github_connection], data)

View File

@ -771,7 +771,7 @@ class GithubConnection(BaseConnection):
def toDict(self):
d = super().toDict()
d.update({
"baseurl": self.baseurl,
"baseurl": self.base_url,
"canonical_hostname": self.canonical_hostname,
"server": self.server,
})