@@ -217,16 +217,31 @@ def test_actor(self):
217
217
self .assertIsInstance (Actor .author (cr ),Actor )
218
218
# END assure config reader is handled
219
219
220
+ @with_rw_repo ('HEAD' )
220
221
@mock .patch ("getpass.getuser" )
221
- def test_actor_get_uid_laziness_not_called (self ,mock_get_uid ):
222
+ def test_actor_get_uid_laziness_not_called (self ,rwrepo ,mock_get_uid ):
223
+ with rwrepo .config_writer ()as cw :
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
+
222
237
env = {
223
238
"GIT_AUTHOR_NAME" :"John Doe" ,
224
239
"GIT_AUTHOR_EMAIL" :"jdoe@example.com" ,
225
240
"GIT_COMMITTER_NAME" :"Jane Doe" ,
226
241
"GIT_COMMITTER_EMAIL" :"jane@example.com" ,
227
242
}
228
243
os .environ .update (env )
229
- for cr in (None ,self . rorepo .config_reader ()):
244
+ for cr in (None ,rwrepo .config_reader ()):
230
245
committer = Actor .committer (cr )
231
246
author = Actor .author (cr )
232
247
self .assertEqual (committer .name ,'Jane Doe' )
@@ -241,7 +256,7 @@ def test_actor_get_uid_laziness_called(self, mock_get_uid):
241
256
committer = Actor .committer (None )
242
257
author = Actor .author (None )
243
258
# 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 theirglobal user.name config set.
245
260
self .assertEqual (committer .name ,'user' )
246
261
self .assertTrue (committer .email .startswith ('user@' ))
247
262
self .assertEqual (author .name ,'user' )