Remove getProjectBranches from FakeGithubConnection
The method getProjectBranches from the GithubConnection is currently not used by any test as it is overridden in FakeGithubConnection. Remove this from here and inject a FakeGithub instead so this method gets tested. This could be improved in the future to also remove more overrides and test more of GithubConnection through the FakeGithub. Change-Id: I0135cd0cc04857abcb93ce73dd5b976a27d26e1d
This commit is contained in:
parent
64e37a0490
commit
90b32ea925
|
@ -559,9 +559,24 @@ class FakeGithub(object):
|
|||
self.name = "Github User"
|
||||
self.email = "github.user@example.com"
|
||||
|
||||
class FakeBranch(object):
|
||||
def __init__(self, branch='master'):
|
||||
self.name = branch
|
||||
|
||||
class FakeRepository(object):
|
||||
def __init__(self):
|
||||
self._branches = [FakeGithub.FakeBranch()]
|
||||
|
||||
def branches(self):
|
||||
return self._branches
|
||||
|
||||
def user(self, login):
|
||||
return self.FakeUser(login)
|
||||
|
||||
def repository(self, owner, proj):
|
||||
repo = self.FakeRepository()
|
||||
return repo
|
||||
|
||||
|
||||
class FakeGithubPullRequest(object):
|
||||
|
||||
|
@ -1000,12 +1015,6 @@ class FakeGithubConnection(githubconnection.GithubConnection):
|
|||
def real_getGitUrl(self, project):
|
||||
return super(FakeGithubConnection, self).getGitUrl(project)
|
||||
|
||||
def getProjectBranches(self, project):
|
||||
"""Masks getProjectBranches since we don't have a real github"""
|
||||
|
||||
# just returns master for now
|
||||
return ['master']
|
||||
|
||||
def commentPull(self, project, pr_number, message):
|
||||
# record that this got reported
|
||||
self.reports.append((project, pr_number, 'comment'))
|
||||
|
|
Loading…
Reference in New Issue