test: reset session user if test errors in test_sle (#25042)

This commit is contained in:
Walstan Baptista 2021-03-27 18:30:07 +05:30 committed by GitHub
parent 868c0bf45b
commit d6c7d8e631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -312,6 +312,7 @@ class TestStockLedgerEntry(unittest.TestCase):
"role_allowed_to_create_edit_back_dated_transactions", "Stock Manager")
# Set User with Stock User role but not Stock Manager
try:
frappe.set_user("test@example.com")
user = frappe.get_doc("User", "test@example.com")
user.add_roles("Stock User")
@ -333,6 +334,7 @@ class TestStockLedgerEntry(unittest.TestCase):
back_dated_se_2.cancel()
stock_entry_on_today.cancel()
finally:
frappe.db.set_value("Stock Settings", None, "role_allowed_to_create_edit_back_dated_transactions", None)
frappe.set_user("Administrator")