Skip to content

Commit 89f9a9a

Browse files
Krista ChanKrista Chan
authored andcommitted
tests: invalid json test
1 parent a232a80 commit 89f9a9a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

apps/report-execution/tests/execute_report.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,19 @@ def test_execute_report_with_library_params(self, mock_db_transaction):
6666
assert result.header == 'Custom Report For Table: random_db_table_0'
6767
assert result.content.columns == ['id', 'name']
6868
assert len(result.content.data) == 4
69+
70+
def test_execute_report_invalid_library_params_type(self):
71+
"""Test that a non-JSON value for library_params raises validation error."""
72+
with pytest.raises(ValueError) as exc_info:
73+
ReportSpec.model_validate(
74+
{
75+
'is_export': True,
76+
'is_builtin': True,
77+
'report_title': 'Invalid Params',
78+
'library_name': 'nbs_custom',
79+
'data_source_name': 'random_db_table_0',
80+
'subset_query': 'SELECT * FROM test',
81+
'library_params': 'not a json object',
82+
}
83+
)
84+
assert 'Invalid JSON' in str(exc_info.value)

0 commit comments

Comments
 (0)