Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd490d66

Browse files
authored
Try a better test
1 parent70b50e0 commitd490d66

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

‎test/test_util.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,31 @@ def test_actor(self):
217217
self.assertIsInstance(Actor.author(cr),Actor)
218218
# END assure config reader is handled
219219

220+
@with_rw_repo('HEAD')
220221
@mock.patch("getpass.getuser")
221-
deftest_actor_get_uid_laziness_not_called(self,mock_get_uid):
222+
deftest_actor_get_uid_laziness_not_called(self,rwrepo,mock_get_uid):
223+
withrwrepo.config_writer()ascw:
224+
cw.set_value("user","name","John Config Doe")
225+
cw.set_value("user","email","jcdoe@example.com")
226+
227+
cr=rwrepo.config_reader()
228+
committer=Actor.committer(cr)
229+
author=Actor.author(cr)
230+
231+
self.assertEqual(committer.name,'John Config Doe')
232+
self.assertEqual(committer.email,'jcdoe@example.com')
233+
self.assertEqual(author.name,'John Config Doe')
234+
self.assertEqual(author.email,'jcdoe@example.com')
235+
self.assertFalse(mock_get_uid.called)
236+
222237
env= {
223238
"GIT_AUTHOR_NAME":"John Doe",
224239
"GIT_AUTHOR_EMAIL":"jdoe@example.com",
225240
"GIT_COMMITTER_NAME":"Jane Doe",
226241
"GIT_COMMITTER_EMAIL":"jane@example.com",
227242
}
228243
os.environ.update(env)
229-
forcrin (None,self.rorepo.config_reader()):
244+
forcrin (None,rwrepo.config_reader()):
230245
committer=Actor.committer(cr)
231246
author=Actor.author(cr)
232247
self.assertEqual(committer.name,'Jane Doe')
@@ -241,7 +256,7 @@ def test_actor_get_uid_laziness_called(self, mock_get_uid):
241256
committer=Actor.committer(None)
242257
author=Actor.author(None)
243258
# We can't test with `self.rorepo.config_reader()` here, as the uuid laziness
244-
# depends on whether the user running the test has their user.name config set.
259+
# depends on whether the user running the test has theirglobaluser.name config set.
245260
self.assertEqual(committer.name,'user')
246261
self.assertTrue(committer.email.startswith('user@'))
247262
self.assertEqual(author.name,'user')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp