Skip to content

Commit

Permalink
ci_ run setup wizard before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Sep 14, 2024
1 parent 6b1e747 commit f442826
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion simple_subscription/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
# Testing
# -------

# before_tests = "simple_subscription.install.before_tests"
before_tests = "simple_subscription.utils.before_tests"

# Overriding Methods
# ------------------------------
Expand Down
29 changes: 29 additions & 0 deletions simple_subscription/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import frappe
from frappe.utils import now_datetime
from frappe.desk.page.setup_wizard.setup_wizard import setup_complete


def before_tests():
# complete setup if missing
year = now_datetime().year
if not frappe.get_list("Company"):
setup_complete(
{
"currency": "EUR",
"full_name": "Test User",
"company_name": "Bolt Trades",
"timezone": "Europe/Berlin",
"company_abbr": "BT",
"industry": "Manufacturing",
"country": "Germany",
"fy_start_date": f"{year}-01-01",
"fy_end_date": f"{year}-12-31",
"language": "english",
"company_tagline": "Testing",
"email": "[email protected]",
"password": "test",
"chart_of_accounts": "Standard",
}
)

frappe.db.commit() # nosemgrep

0 comments on commit f442826

Please sign in to comment.