Skip to content

Commit

Permalink
add test case for grants method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jer-Sch committed Sep 23, 2021
1 parent 7ac8bb6 commit 48e9400
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/grants/tests/models/test_grant_clr.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,15 @@ def test_grants_method_calls_filter_with_expected_parameters_if_collection_filte
filter.assert_called_with(**grant_clr.collection_filters)
values_list.assert_called_with('grants', flat=True)


def test_grants_method_does_not_call_filter_if_collection_filters_are_not_present(self):
grant_clr = GrantCLRFactory()

with patch.object(GrantCollection.objects, 'filter') as filter:
with patch.object(GrantCollection.objects.filter(**grant_clr.collection_filters), 'values_list') as values_list:
grant_clr.grants

filter.assert_not_called
values_list.assert_not_called

def test_record_clr_prediction_curve_calls_collaborator_with_expected_parameters(self):
"""Test record_clr_prediction_curve calls create on GrantCLRCalculation.objects with expected params."""
Expand Down

0 comments on commit 48e9400

Please sign in to comment.