Beispiel #1
0
 def test_it_returns_list_containing_version_types(self):
     assert media_types.valid_media_types() == [
         "*/*",
         "application/json",
         "application/vnd.hypothesis.v1+json",
         "application/vnd.hypothesis.v2+json",
     ]
Beispiel #2
0
 def test_it_returns_list_containing_version_types(self):
     assert media_types.valid_media_types() == [
         "*/*",
         "application/json",
         "application/vnd.hypothesis.v1+json",
         "application/vnd.hypothesis.v2+json",
     ]
Beispiel #3
0
 def test_it_returns_list_containing_version_types(self):
     assert media_types.valid_media_types(["foo", "bar"]) == [
         "*/*",
         "application/json",
         "application/vnd.hypothesis.foo+json",
         "application/vnd.hypothesis.bar+json",
     ]
Beispiel #4
0
 def wrapper(context, request):
     # If Accept has been set
     if request.accept:
         # At least one of the media types in Accept must be known to the app
         if not any([t in valid_media_types() for t in request.accept]):
             # If no Accept media types are known, convert to a 406 error
             context = HTTPNotAcceptable("Not acceptable")
     response = wrapped(context, request)
     return response