Add support for github enterprise

GitHub enterprise just requires setting a git_host to something other
than the default of 'github.com'. If this host is set to something else,
perform an enterprise_login() instead of a login(). All other activity
appears to be the same.

A more complete change would be allowing clone/push using the API key
instead of the ssh key, which would reduce the amount of credentials one
must manage on the zuul host.

Change-Id: I4db7677cf5ff0bf798e20dcbc327e1dd874a2e7e
diff --git a/tests/fixtures/zuul-github-driver.conf b/tests/fixtures/zuul-github-driver.conf
index 58c7cd5..ab34619 100644
--- a/tests/fixtures/zuul-github-driver.conf
+++ b/tests/fixtures/zuul-github-driver.conf
@@ -20,3 +20,8 @@
 [connection github_ssh]
 driver=github
 sshkey=/home/zuul/.ssh/id_rsa
+
+[connection github_ent]
+driver=github
+sshkey=/home/zuul/.ssh/id_rsa
+git_host=github.enterprise.io
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index e8abf79..a1a05e0 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -230,6 +230,12 @@
         url = self.fake_github_ssh.real_getGitUrl('org/project')
         self.assertEqual('ssh://git@github.com/org/project.git', url)
 
+    @simple_layout('layouts/basic-github.yaml', driver='github')
+    def test_git_enterprise_url(self):
+        """Test that git_url option gives git url with proper host"""
+        url = self.fake_github_ent.real_getGitUrl('org/project')
+        self.assertEqual('ssh://git@github.enterprise.io/org/project.git', url)
+
     @simple_layout('layouts/reporting-github.yaml', driver='github')
     def test_reporting(self):
         # pipeline reports pull status both on start and success