aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2016-11-24 12:17:50 +0100
committerGuido Günther <agx@sigxcpu.org>2016-12-19 08:32:38 +0100
commit67cf3ed1bb667816baff586b75d991142d1840ef (patch)
tree96e3e5187658afb22288d9b410fc5e1abe4efad3 /tests
parent9cbb9df7d8e05ce9c356216e3c4ac190141c0d02 (diff)
gbp clone: configure user.email, user.name from DEBEMAIL/DEBFULLNAME
Signed-off-by: Guido Günther <agx@sigxcpu.org> Close: #845536
Diffstat (limited to 'tests')
-rw-r--r--tests/component/deb/test_clone.py24
-rw-r--r--tests/doctests/test_GitRepository.py13
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/component/deb/test_clone.py b/tests/component/deb/test_clone.py
index 0c3ba2c..61bf46e 100644
--- a/tests/component/deb/test_clone.py
+++ b/tests/component/deb/test_clone.py
@@ -72,3 +72,27 @@ class TestClone(ComponentTestBase):
self._check_repo_state(cloned, 'master', ['master'])
assert len(cloned.get_commits()) == 1
self.check_hook_vars('postclone', ["GBP_GIT_DIR"])
+
+ def test_clone_environ(self):
+ """Test that environment variables influence git configuration"""
+ def _dsc(version):
+ return os.path.join(DEB_TEST_DATA_DIR,
+ 'dsc-native',
+ 'git-buildpackage_%s.dsc' % version)
+
+ # Build up somethng we can clone from
+ dsc = _dsc('0.4.14')
+ os.environ['DEBFULLNAME'] = 'testing tester'
+ os.environ['DEBEMAIL'] = 'gbp-tester@debian.invalid'
+ assert import_dsc(['arg0', dsc]) == 0
+ repo = ComponentTestGitRepository('git-buildpackage')
+ self._check_repo_state(repo, 'master', ['master'])
+ assert len(repo.get_commits()) == 1
+
+ got = repo.get_config("user.email")
+ want = os.environ['DEBEMAIL']
+ ok_(got == want, "unexpected git config user.email: got %s, want %s" % (got, want))
+
+ got = repo.get_config("user.name")
+ want = os.environ['DEBFULLNAME']
+ ok_(got == want, "unexpected git config user.name: got %s, want %s" % (got, want))
diff --git a/tests/doctests/test_GitRepository.py b/tests/doctests/test_GitRepository.py
index bd7c005..a5d6c53 100644
--- a/tests/doctests/test_GitRepository.py
+++ b/tests/doctests/test_GitRepository.py
@@ -996,4 +996,17 @@ def test_cmd_has_feature():
True
"""
+
+def test_set_user_name_and_email():
+ r"""
+ Methods tested:
+ - L{gbp.git.GitRepository.set_user_name}
+ - L{gbp.git.GitRepository.set_user_email}
+
+ >>> import gbp.git
+ >>> repo = gbp.git.GitRepository(dirs['repo'])
+ >>> repo.set_user_name("Michael Stapelberg")
+ >>> repo.set_user_email("stapelberg@test.invalid")
+ """
+
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: