def test_convert_errors(self):
     view = MockResourceView([], content_type='application/vnd.Collection.next+JSON')
     form_class = view.get_form_class()
     form = form_class(data={})
     assert form.errors
     adaptor = CollectionNextJSON(view)
     error_r = adaptor.convert_errors(form.errors)
     self.assertEqual(len(error_r['messages']), len(form.errors))
 def test_convert_field(self):
     view = MockResourceView([], content_type='application/vnd.Collection.next+JSON')
     form_class = view.get_form_class()
     form = form_class()
     fields = form.fields.items()
     name, field = fields[0]
     adaptor = CollectionNextJSON(view)
     field_r = adaptor.convert_field(field, name)
     self.assertEqual(field_r['required'], field.required)
Beispiel #3
0
 def get_adaptor(self):
     self.api_request = self.get_api_request()
     return CollectionNextJSON(self.api_request)