From 6903bd78aa5082dbe3c2834967380ff49ebda3d5 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 12 Nov 2013 18:26:34 +0000 Subject: GitDir: Add support for push urls in Remote --- morphlib/gitdir_tests.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'morphlib/gitdir_tests.py') 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) -- cgit v1.2.1