changeset 7197:47c8221a6169

git: add a bit of submodule test coverage
author domruf <dominikruf@gmail.com>
date Mon, 20 Nov 2017 23:18:38 +0100
parents c0cfcf334ba7
children 1c56ba483b84
files kallithea/tests/other/test_vcs_operations.py
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/other/test_vcs_operations.py	Sun Mar 11 17:33:01 2018 +0100
+++ b/kallithea/tests/other/test_vcs_operations.py	Mon Nov 20 23:18:38 2017 +0100
@@ -666,3 +666,27 @@
         stdout, stderr = _check_outgoing(repo_type, dest_dir, clone_url)
         assert stdout == ''
         assert stderr == ''
+
+    def test_add_submodule(self, webserver):
+        dest_dir = _get_tmp_dir()
+        clone_url = webserver.repo_url(GIT_REPO)
+
+        # GIT_REPO should be untouched for other tests so create a fork
+        fork_name = '%s_fork%s' % (GIT_REPO, _RandomNameSequence().next())
+        fixture.create_fork(GIT_REPO, fork_name)
+        fork_url = webserver.repo_url(fork_name)
+
+        # add submodule
+        stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', fork_url, dest_dir)
+        stdout, stderr = Command(dest_dir).execute('git submodule add', clone_url, 'testsubmodule')
+        stdout, stderr = Command(dest_dir).execute('git commit -am "added testsubmodule pointing to', clone_url, '"')
+        stdout, stderr = Command(dest_dir).execute('git push', fork_url, 'master')
+
+        # check for testsubmodule link in files page
+        self.log_user()
+        response = self.app.get(url(controller='files', action='index',
+                                    repo_name=fork_name,
+                                    revision='tip',
+                                    f_path='/'))
+        # BUG: the link to testsubmodule doesn't work - it should probably point at the submodule URL
+        response.mustcontain('<a class="submodule-dir ypjax-link" href="testsubmodule"><i class="icon-file-submodule"></i><span>testsubmodule @ ')