Configurable SSH access to GitHub
Change-Id: I2ad5b17991d25ec7492d931c069cbcf314dba804
diff --git a/tests/base.py b/tests/base.py
index 1092c6e..56b1269 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -736,6 +736,9 @@
def getGitUrl(self, project):
return os.path.join(self.upstream_root, str(project))
+ 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"""
diff --git a/tests/fixtures/zuul-github-driver.conf b/tests/fixtures/zuul-github-driver.conf
index b979a3f..b4a85f7 100644
--- a/tests/fixtures/zuul-github-driver.conf
+++ b/tests/fixtures/zuul-github-driver.conf
@@ -15,3 +15,7 @@
[connection github]
driver=github
+
+[connection github_ssh]
+driver=github
+sshkey=/home/zuul/.ssh/id_rsa
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index c9847b2..1e5f6a6 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -110,3 +110,15 @@
self.assertEqual('SUCCESS',
self.getJobFromHistory('project-post').result)
+
+ @simple_layout('layouts/basic-github.yaml', driver='github')
+ def test_git_https_url(self):
+ """Test that git_ssh option gives git url with ssh"""
+ url = self.fake_github.real_getGitUrl('org/project')
+ self.assertEqual('https://github.com/org/project', url)
+
+ @simple_layout('layouts/basic-github.yaml', driver='github')
+ def test_git_ssh_url(self):
+ """Test that git_ssh option gives git url with ssh"""
+ url = self.fake_github_ssh.real_getGitUrl('org/project')
+ self.assertEqual('ssh://git@github.com/org/project.git', url)