diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 21:07:33 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 21:07:33 +0100 |
commit | 33964afb47ce3af8a32e6613b0834e5f94bdfe68 (patch) | |
tree | 36f73238c134a3b1264b7e1b64602e7a005beaab /test/git/test_submodule.py | |
parent | 98e6edb546116cd98abdc3b37c6744e859bbde5c (diff) | |
download | gitpython-33964afb47ce3af8a32e6613b0834e5f94bdfe68.tar.gz |
Added tests for all failure modes of submodule add ( except for one ), and fixed a few issues on the way
Diffstat (limited to 'test/git/test_submodule.py')
-rw-r--r-- | test/git/test_submodule.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/git/test_submodule.py b/test/git/test_submodule.py index 6172fed5..b66c4d9f 100644 --- a/test/git/test_submodule.py +++ b/test/git/test_submodule.py @@ -99,6 +99,21 @@ class TestSubmodule(TestBase): # currently there is only one submodule assert len(list(rwrepo.iter_submodules())) == 1 + # TEST ADD + ########### + # preliminary tests + # adding existing returns exactly the existing + sma = Submodule.add(rwrepo, sm.name, sm.path) + assert sma.path == sm.path + + # no url and no module at path fails + self.failUnlessRaises(ValueError, Submodule.add, rwrepo, "newsubm", "pathtorepo", url=None) + + # TODO: Test no remote url in existing repository + + # CONTINUE UPDATE + ################# + # lets update it - its a recursive one too newdir = os.path.join(sm.module_path(), 'dir') os.makedirs(newdir) @@ -112,6 +127,15 @@ class TestSubmodule(TestBase): assert isinstance(sm.module(), git.Repo) assert sm.module().working_tree_dir == sm.module_path() + # INTERLEAVE ADD TEST + ##################### + # url must match the one in the existing repository ( if submodule name suggests a new one ) + # or we raise + self.failUnlessRaises(ValueError, Submodule.add, rwrepo, "newsubm", sm.path, "git://someurl/repo.git") + + + # CONTINUE UPDATE + ################# # we should have setup a tracking branch, which is also active assert sm.module().head.ref.tracking_branch() is not None |