Skip to content

Commit

Permalink
feat: created testcase for happy path
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-hd committed Oct 15, 2024
1 parent a5d5ff6 commit fa9cf33
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/functional/test_native_land_data_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ def test_error_raised_when_error_occurs_retrieving_all_nld_data(self):
data=get_variables
)
self.assertEqual(response.context['exception'], expected_message)

def test_no_error_raised_when_getting_data_for_slug(self):
"""
No error is raised when getting data for slug
"""
slug = 'placeholder_slug'
get_variables = {
'slug': slug,
}
with patch('helpers.views.retrieve_native_land_all_slug_data') as mock_function:
specific_slug_data = {'foo': 'bar'}
mock_function.return_value = {
slug: specific_slug_data
}
response = self.client.get(
reverse('nld-data'),
data=get_variables
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), specific_slug_data)

0 comments on commit fa9cf33

Please sign in to comment.