Skip to content

Commit

Permalink
test: let fake_getpwuid return pwd.struct_passwd
Browse files Browse the repository at this point in the history
`pwd.getpwuid` returns a `pwd.struct_passwd`. So let `fake_getpwuid`
return the same type.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
  • Loading branch information
bdrung authored and schopin-pro committed Nov 7, 2023
1 parent 4182f28 commit 2fdb988
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/integration/test_ui.py
Expand Up @@ -1582,10 +1582,10 @@ def test_run_crash_anonymity_escaping(self):
orig_getpwuid = pwd.getpwuid
orig_getuid = os.getuid

def fake_getpwuid(_unused_uid):
def fake_getpwuid(_unused_uid: int) -> pwd.struct_passwd:
r = list(orig_getpwuid(orig_getuid()))
r[4] = "Joe (Hacker,+1 234,,"
return r
return pwd.struct_passwd(r)

pwd.getpwuid = fake_getpwuid
os.getuid = lambda: 1234
Expand Down

0 comments on commit 2fdb988

Please sign in to comment.