fix(test): provide a helpful error message

This commit is contained in:
Raffael Meyer
2019-04-19 00:21:44 +02:00
parent 22ad81fb57
commit df16cdcf31

View File

@@ -4,6 +4,8 @@ from __future__ import unicode_literals
import frappe
import unittest
import json
from frappe import _
from frappe.utils import random_string
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import get_charts_for_country
@@ -78,7 +80,10 @@ class TestCompany(unittest.TestCase):
if account_type in ["Bank", "Cash"]:
filters["is_group"] = 1
self.assertTrue(frappe.get_all("Account", filters))
has_matching_accounts = frappe.get_all("Account", filters)
error_message = _("No Account matched these filters: {}".format(json.dumps(filters)))
self.assertTrue(has_matching_accounts, msg=error_message)
finally:
self.delete_mode_of_payment(template)
frappe.delete_doc("Company", template)