def test_class_context_manager_bad_factory():
class_session = Session()
class TestMockClass(BaseMockClass):
def _test_json(self, request):
return StaticResponseFactory.BadResponse(
request=request,
body=b("it's not over"),
headers={'now': 'never'},
)
with mock_session_with_class(class_session, TestMockClass, 'http://test.com'):
response = class_session.get('http://test.com/test.json')
assert response.text == "it's not over"
assert 'now' in response.headers.keys()
assert response.headers['now'] == 'never'
assert response.status_code == DEFAULT_BAD_STATUS_CODE
test_requests_staticmock.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录