We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 589b5dc commit e1edf8bCopy full SHA for e1edf8b
1 file changed
tests/test_decorators.py
@@ -1,3 +1,5 @@
1
+from http import HTTPMethod
2
+
3
import pytest
4
from django.test import TestCase
5
@@ -187,6 +189,17 @@ def test_action(request):
187
189
188
190
assert str(excinfo.value) == "@action() missing required argument: 'detail'"
191
192
+ def test_method_mapping_http_method(self):
193
+ method_names = [getattr(HTTPMethod, name.upper()) for name in APIView.http_method_names]
194
195
+ @action(detail=False, methods=method_names)
196
+ def test_action():
197
+ raise NotImplementedError
198
199
+ expected_mapping = {name: test_action.__name__ for name in APIView.http_method_names}
200
201
+ assert test_action.mapping == expected_mapping
202
203
def test_method_mapping_http_methods(self):
204
# All HTTP methods should be mappable
205
@action(detail=False, methods=[])
0 commit comments