summaryrefslogtreecommitdiff
path: root/morphlib/gitdir_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-11-12 18:26:34 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-11-22 13:49:26 +0000
commit6903bd78aa5082dbe3c2834967380ff49ebda3d5 (patch)
treec9f737b4a699da30ce9427689543ea1bcce0fcaf /morphlib/gitdir_tests.py
parent0f757009e17ed38f6aa8012691747f465872a994 (diff)
downloadmorph-6903bd78aa5082dbe3c2834967380ff49ebda3d5.tar.gz
GitDir: Add support for push urls in Remote
Diffstat (limited to 'morphlib/gitdir_tests.py')
-rw-r--r--morphlib/gitdir_tests.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/morphlib/gitdir_tests.py b/morphlib/gitdir_tests.py
index 2adbec62..c7cb50f6 100644
--- a/morphlib/gitdir_tests.py
+++ b/morphlib/gitdir_tests.py
@@ -290,23 +290,31 @@ class GitDirectoryRemoteConfigTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tempdir)
- def test_sets_fetch_url(self):
+ def test_sets_urls(self):
os.mkdir(self.dirname)
gitdir = morphlib.gitdir.init(self.dirname)
- self.assertEqual(gitdir.get_remote('origin').get_fetch_url(), None)
-
- gitdir._runcmd(['git', 'remote', 'add', 'origin', 'foobar'])
- url = 'git://git.example.com/foo'
remote = gitdir.get_remote('origin')
- remote.set_fetch_url(url)
- self.assertEqual(remote.get_fetch_url(), url)
+ self.assertEqual(remote.get_fetch_url(), None)
+ self.assertEqual(remote.get_push_url(), None)
- def test_nascent_remote(self):
+ gitdir._runcmd(['git', 'remote', 'add', 'origin', 'foobar'])
+ fetch_url = 'git://git.example.com/foo.git'
+ push_url = 'ssh://git@git.example.com/foo.git'
+ remote.set_fetch_url(fetch_url)
+ remote.set_push_url(push_url)
+ self.assertEqual(remote.get_fetch_url(), fetch_url)
+ self.assertEqual(remote.get_push_url(), push_url)
+
+ def test_nascent_remote_fetch(self):
os.mkdir(self.dirname)
gitdir = morphlib.gitdir.init(self.dirname)
remote = gitdir.get_remote(None)
self.assertEqual(remote.get_fetch_url(), None)
-
- url = 'git://git.example.com/foo'
- remote.set_fetch_url(url)
- self.assertEqual(remote.get_fetch_url(), url)
+ self.assertEqual(remote.get_push_url(), None)
+
+ fetch_url = 'git://git.example.com/foo.git'
+ push_url = 'ssh://git@git.example.com/foo.git'
+ remote.set_fetch_url(fetch_url)
+ remote.set_push_url(push_url)
+ self.assertEqual(remote.get_fetch_url(), fetch_url)
+ self.assertEqual(remote.get_push_url(), push_url)