summaryrefslogtreecommitdiff
path: root/test/test_util.py
diff options
context:
space:
mode:
authorAthos Ribeiro <athos@redhat.com>2020-10-23 12:00:17 +0200
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-10-23 19:28:07 +0800
commit08989071e8c47bb75f3a5f171d821b805380baef (patch)
treef57ebf19469f199389bf9d7cfe2a39de8d267e99 /test/test_util.py
parente30a597b028290c7f703e68c4698499b3362a38f (diff)
downloadgitpython-08989071e8c47bb75f3a5f171d821b805380baef.tar.gz
Fix default actor name handling
In c96476b, the new default_name nested function does not contain a retun statement. This leads to an issue when the environment variables are not present, where the actor name would not be set. Signed-off-by: Athos Ribeiro <athos@redhat.com>
Diffstat (limited to 'test/test_util.py')
-rw-r--r--test/test_util.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/test_util.py b/test/test_util.py
index 2f946891..5eba6c50 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -226,15 +226,25 @@ class TestUtils(TestBase):
}
os.environ.update(env)
for cr in (None, self.rorepo.config_reader()):
- Actor.committer(cr)
- Actor.author(cr)
+ committer = Actor.committer(cr)
+ author = Actor.author(cr)
+ self.assertEqual(committer.name, 'Jane Doe')
+ self.assertEqual(committer.email, 'jane@example.com')
+ self.assertEqual(author.name, 'John Doe')
+ self.assertEqual(author.email, 'jdoe@example.com')
self.assertFalse(mock_get_uid.called)
@mock.patch("getpass.getuser")
def test_actor_get_uid_laziness_called(self, mock_get_uid):
+ mock_get_uid.return_value = "user"
for cr in (None, self.rorepo.config_reader()):
- Actor.committer(cr)
- Actor.author(cr)
+ committer = Actor.committer(cr)
+ author = Actor.author(cr)
+ if cr is None: # otherwise, use value from config_reader
+ self.assertEqual(committer.name, 'user')
+ self.assertTrue(committer.email.startswith('user@'))
+ self.assertEqual(author.name, 'user')
+ self.assertTrue(committer.email.startswith('user@'))
self.assertTrue(mock_get_uid.called)
self.assertEqual(mock_get_uid.call_count, 4)