summaryrefslogtreecommitdiff
path: root/morphlib/gitdir_tests.py
diff options
context:
space:
mode:
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)