def test_request_cls_none():
class Person(Model):
name = StringType()
class PersonAPI(HTTPEater):
request_cls = None
response_cls = Person
url = 'http://example.com/person'
expected_person = Person(dict(name='John'))
api = PersonAPI(name=expected_person.name)
with requests_mock.Mocker() as mock:
mock.get(
api.url,
json=expected_person.to_primitive(),
headers=JSON_HEADERS
)
actual_person = api()
assert actual_person == expected_person
评论列表
文章目录