fix: test

This commit is contained in:
Saif Ur Rehman 2019-04-18 18:39:58 +05:00
parent a496e5b91c
commit 539c4f72a0
2 changed files with 6 additions and 6 deletions

View file

@ -255,7 +255,8 @@ class DocType(Document):
self.update_fields_to_fetch()
from frappe import conf
if not self.custom and not (frappe.flags.in_import or frappe.flags.in_test) and conf.get('developer_mode'):
allow_doctype_export = frappe.flags.allow_doctype_export or (not frappe.flags.in_test and conf.get('developer_mode'))
if not self.custom and not frappe.flags.in_import and allow_doctype_export:
self.export_doc()
self.make_controller_template()

View file

@ -152,7 +152,7 @@ class TestDocType(unittest.TestCase):
os.remove(path)
try:
frappe.flags.in_test = 0
frappe.flags.allow_doctype_export = 1
test_doctype.save()
# assert that field_order list is being created with the default order
@ -222,8 +222,7 @@ class TestDocType(unittest.TestCase):
test_doctype_json = frappe.get_file_json(path)
self.assertListEqual([f['fieldname'] for f in test_doctype_json['fields']], ['field_1', 'field_2', 'field_4', 'field_5'])
self.assertListEqual(test_doctype_json['field_order'], ['field_4', 'field_5', 'field_1', 'field_2'])
except Exception:
frappe.flags.in_test = 1
except:
raise
frappe.flags.in_test = 1
finally:
frappe.flags.allow_doctype_export = 0