Commit 7aa01301 authored by Makarand Bauskar's avatar Makarand Bauskar Committed by GitHub
Browse files

[minor][https://github.com/frappe/erpnext/issues/9892] enabled all roles and...

[minor][https://github.com/frappe/erpnext/issues/9892] enabled all roles and domain before running tests (#3719)
parent 368bbeeb
Showing with 22 additions and 2 deletions
+22 -2
......@@ -110,6 +110,7 @@ def before_tests():
"timezone" :"America/New_York",
"currency" :"USD"
})
enable_all_roles_and_domains()
frappe.db.commit()
frappe.clear_cache()
......@@ -125,8 +126,6 @@ def import_country_and_currency():
country = frappe._dict(data[name])
add_country_and_currency(name, country)
print()
# enable frequently used currencies
for currency in ("INR", "USD", "GBP", "EUR", "AED", "AUD", "JPY", "CNY", "CHF"):
frappe.db.set_value("Currency", currency, "enabled", 1)
......@@ -154,3 +153,24 @@ def add_country_and_currency(name, country):
"docstatus": 0
}).db_insert()
def enable_all_roles_and_domains():
""" enable all roles and domain for testing """
roles = frappe.get_list("Role", filters={"disabled": 1})
for role in roles:
_role = frappe.get_doc("Role", role.get("name"))
_role.disabled = 0
_role.flags.ignore_mandatory = True
_role.flags.ignore_permissions = True
_role.save()
domains = frappe.get_list("Domain")
if not domains:
return
domain_settigns = frappe.get_doc("Domain Settings", "Domain Settings")
domain_settigns.set("active_domains", [])
for domain in domains:
row = domain_settigns.append("active_domains", {})
row.domain=domain.get("name")
domain_settigns.save()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment