Skip to content

Commit f855e5d

Browse files
committed
Move the bogus missing user db path into output dir to make sure e.g. locking
artifacts end up in there rather than in root dir.
1 parent db28bac commit f855e5d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/test_mig_shared_useradm.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
OTHER_USER_DN = '/C=DK/ST=NA/L=NA/O=Other Org/OU=NA/CN=Other User/emailAddress=other@example.com'
7474
OTHER_USER_EMAIL = 'other@email.org'
7575

76+
# NOTE: use a bogus path in output to make sure lock artifacts end up there
77+
NO_SUCH_USER_DB = os.path.join(TEST_OUTPUT_DIR, 'no_such_user.db')
78+
7679
DUMMY_USER = "dummy-user"
7780
DUMMY_STALE_USER = "dummy-stale-user"
7881
DUMMY_HOME_DIR = "dummy_user_home"
@@ -485,14 +488,17 @@ def test_missing_user_db_bails_out(self):
485488
with self.assertLogs(level='ERROR') as log_capture:
486489
(_, username, full_name, expire, addresses, errors) = \
487490
user_account_notify(OTHER_USER_DN, {'email': ['AUTO']},
488-
self.configuration,
489-
'no_such_user_db', False,
490-
False)
491+
self.configuration, NO_SUCH_USER_DB,
492+
False, False)
491493
self.assertEqual(addresses, [])
492494
self.assertEqual(expire, None)
493495
self.assertTrue(errors and 'Failed to load user DB' in errors[0])
494496
self.assertTrue(any('Failed to load user DB' in msg for msg in
495497
log_capture.output))
498+
try:
499+
os.remove("%s.lock" % NO_SUCH_USER_DB)
500+
except Exception:
501+
pass
496502

497503

498504
if __name__ == "__main__":

0 commit comments

Comments
 (0)