Skip to content

Commit

Permalink
fix(reportview): test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta committed Mar 30, 2021
1 parent 82399dd commit 337bdc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frappe/desk/reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ def validate_args(data):
return data

def validate_fields(data):
if update_wildcard_field_param(data):
# no need to validate wildcard fields
return
wildcard = update_wildcard_field_param(data)

for field in data.fields or []:
fieldname = extract_fieldname(field)
Expand All @@ -71,7 +69,10 @@ def validate_fields(data):
meta, df = get_meta_and_docfield(fieldname, data)

if not df:
raise_invalid_field(fieldname)
if wildcard:
continue
else:
raise_invalid_field(fieldname)

# remove the field from the query if the report hide flag is set and current view is Report
if df.report_hide and data.view == 'Report':
Expand Down
3 changes: 3 additions & 0 deletions frappe/tests/test_db_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
test_dependencies = ['User', 'Blog Post', 'Blog Category', 'Blogger']

class TestReportview(unittest.TestCase):
def setUp(self):
frappe.set_user("Administrator")

def test_basic(self):
self.assertTrue({"name":"DocType"} in DatabaseQuery("DocType").execute(limit_page_length=None))

Expand Down

0 comments on commit 337bdc9

Please sign in to comment.