test: reset session user if test errors in test_sle (#25042)
This commit is contained in:
parent
868c0bf45b
commit
d6c7d8e631
@ -312,6 +312,7 @@ class TestStockLedgerEntry(unittest.TestCase):
|
|||||||
"role_allowed_to_create_edit_back_dated_transactions", "Stock Manager")
|
"role_allowed_to_create_edit_back_dated_transactions", "Stock Manager")
|
||||||
|
|
||||||
# Set User with Stock User role but not Stock Manager
|
# Set User with Stock User role but not Stock Manager
|
||||||
|
try:
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
user = frappe.get_doc("User", "test@example.com")
|
user = frappe.get_doc("User", "test@example.com")
|
||||||
user.add_roles("Stock User")
|
user.add_roles("Stock User")
|
||||||
@ -333,6 +334,7 @@ class TestStockLedgerEntry(unittest.TestCase):
|
|||||||
back_dated_se_2.cancel()
|
back_dated_se_2.cancel()
|
||||||
stock_entry_on_today.cancel()
|
stock_entry_on_today.cancel()
|
||||||
|
|
||||||
|
finally:
|
||||||
frappe.db.set_value("Stock Settings", None, "role_allowed_to_create_edit_back_dated_transactions", None)
|
frappe.db.set_value("Stock Settings", None, "role_allowed_to_create_edit_back_dated_transactions", None)
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user