mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 21:40:13 +03:00
converted test_viewsets to pytest style
This commit is contained in:
parent
3e1b31bb9b
commit
4ec8bc5de0
|
@ -21,15 +21,15 @@ class InitializeViewSetsTestCase(TestCase):
|
||||||
})
|
})
|
||||||
|
|
||||||
response = my_view(request)
|
response = my_view(request)
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
assert response.status_code == status.HTTP_200_OK
|
||||||
self.assertEqual(response.data, {'ACTION': 'LIST'})
|
assert response.data == {'ACTION': 'LIST'}
|
||||||
|
|
||||||
def test_initialize_view_set_with_empty_actions(self):
|
def test_initialize_view_set_with_empty_actions(self):
|
||||||
try:
|
try:
|
||||||
BasicViewSet.as_view()
|
BasicViewSet.as_view()
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
self.assertEqual(str(e), "The `actions` argument must be provided "
|
assert str(e) == "The `actions` argument must be provided "
|
||||||
"when calling `.as_view()` on a ViewSet. "
|
"when calling `.as_view()` on a ViewSet. "
|
||||||
"For example `.as_view({'get': 'list'})`")
|
"For example `.as_view({'get': 'list'})`"
|
||||||
else:
|
else:
|
||||||
self.fail("actions must not be empty.")
|
self.fail("actions must not be empty.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user