Example #1
0
    def test_multiple_urls(self, rw_repo):
        # test addresses
        test1 = 'https://github.com/gitpython-developers/GitPython'
        test2 = 'https://github.com/gitpython-developers/gitdb'
        test3 = 'https://github.com/gitpython-developers/smmap'

        remote = rw_repo.remotes[0]
        # Testing setting a single URL
        remote.set_url(test1)
        assert list(remote.urls) == [test1]

        # Testing replacing that single URL
        remote.set_url(test1)
        assert list(remote.urls) == [test1]
        # Testing adding new URLs
        remote.set_url(test2, add=True)
        assert list(remote.urls) == [test1, test2]
        remote.set_url(test3, add=True)
        assert list(remote.urls) == [test1, test2, test3]
        # Testing removing an URL
        remote.set_url(test2, delete=True)
        assert list(remote.urls) == [test1, test3]
        # Testing changing an URL
        remote.set_url(test3, test2)
        assert list(remote.urls) == [test1, test2]

        # will raise: fatal: --add --delete doesn't make sense
        assert_raises(GitCommandError,
                      remote.set_url,
                      test2,
                      add=True,
                      delete=True)

        # Testing on another remote, with the add/delete URL
        remote = rw_repo.create_remote('another', url=test1)
        remote.add_url(test2)
        assert list(remote.urls) == [test1, test2]
        remote.add_url(test3)
        assert list(remote.urls) == [test1, test2, test3]
        # Testing removing all the URLs
        remote.delete_url(test2)
        assert list(remote.urls) == [test1, test3]
        remote.delete_url(test1)
        assert list(remote.urls) == [test3]
        # will raise fatal: Will not delete all non-push URLs
        assert_raises(GitCommandError, remote.delete_url, test3)
Example #2
0
    def test_multiple_urls(self, rw_repo):
        # test addresses
        test1 = 'https://github.com/gitpython-developers/GitPython'
        test2 = 'https://github.com/gitpython-developers/gitdb'
        test3 = 'https://github.com/gitpython-developers/smmap'

        remote = rw_repo.remotes[0]
        # Testing setting a single URL
        remote.set_url(test1)
        self.assertEqual(list(remote.urls), [test1])

        # Testing replacing that single URL
        remote.set_url(test1)
        self.assertEqual(list(remote.urls), [test1])
        # Testing adding new URLs
        remote.set_url(test2, add=True)
        self.assertEqual(list(remote.urls), [test1, test2])
        remote.set_url(test3, add=True)
        self.assertEqual(list(remote.urls), [test1, test2, test3])
        # Testing removing an URL
        remote.set_url(test2, delete=True)
        self.assertEqual(list(remote.urls), [test1, test3])
        # Testing changing an URL
        remote.set_url(test3, test2)
        self.assertEqual(list(remote.urls), [test1, test2])

        # will raise: fatal: --add --delete doesn't make sense
        assert_raises(GitCommandError, remote.set_url, test2, add=True, delete=True)

        # Testing on another remote, with the add/delete URL
        remote = rw_repo.create_remote('another', url=test1)
        remote.add_url(test2)
        self.assertEqual(list(remote.urls), [test1, test2])
        remote.add_url(test3)
        self.assertEqual(list(remote.urls), [test1, test2, test3])
        # Testing removing all the URLs
        remote.delete_url(test2)
        self.assertEqual(list(remote.urls), [test1, test3])
        remote.delete_url(test1)
        self.assertEqual(list(remote.urls), [test3])
        # will raise fatal: Will not delete all non-push URLs
        assert_raises(GitCommandError, remote.delete_url, test3)
Example #3
0
    def test_get_object_type_by_name(self):
        for tname in base.Object.TYPES:
            assert base.Object in get_object_type_by_name(tname).mro()
        # END for each known type

        assert_raises(ValueError, get_object_type_by_name, b"doesntexist")
    def test_get_object_type_by_name(self):
        for tname in base.Object.TYPES:
            assert base.Object in get_object_type_by_name(tname).mro()
        # END for each known type

        assert_raises(ValueError, get_object_type_by_name, b"doesntexist")