def test_return_body_if_valid(self):
     response_mock = ResponseMock(body='body', code=200)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_equal('body')
 def test_return_body_if_valid(self):
     response_mock = ResponseMock(body='body', code=200)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_equal('body')
 def test_return_none_on_error(self):
     response_mock = ResponseMock(error='Error', code=599)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
 def test_return_none_on_error(self):
     response_mock = ResponseMock(error='Error', code=599)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
 def test_return_upstream_error_on_body_empty(self):
     response_mock = ResponseMock(body='', code=200)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
     expect(result.error).to_equal(LoaderResult.ERROR_UPSTREAM)
 def test_return_upstream_error_on_body_empty(self):
     response_mock = ResponseMock(body='', code=200)
     callback_mock = mock.Mock()
     ctx = Context(None, None, None)
     loader.return_contents(response_mock, 'some-url', callback_mock, ctx)
     result = callback_mock.call_args[0][0]
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
     expect(result.error).to_equal(LoaderResult.ERROR_UPSTREAM)
Exemple #7
0
 async def test_return_none_on_error(self):
     response_mock = ResponseMock(error="Error", code=599)
     ctx = Context(None, None, None)
     result = loader.return_contents(response_mock, "some-url", ctx)
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
Exemple #8
0
 async def test_return_upstream_error_on_body_empty(self):
     response_mock = ResponseMock(body="", code=200)
     ctx = Context(None, None, None)
     result = loader.return_contents(response_mock, "some-url", ctx)
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_be_null()
     expect(result.successful).to_be_false()
     expect(result.error).to_equal(LoaderResult.ERROR_UPSTREAM)
 def topic(self, callback):
     mock = ResponseMock(body='body', code=200)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
 def topic(self, callback):
     mock = ResponseMock(error='Error', code=599)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
 def topic(self, callback):
     mock = ResponseMock(body='body', code=200)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
 def topic(self, callback):
     mock = ResponseMock(error='Error', code=599)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
Exemple #13
0
 async def test_return_body_if_valid(self):
     response_mock = ResponseMock(body="body", code=200)
     ctx = Context(None, None, None)
     result = loader.return_contents(response_mock, "some-url", ctx)
     expect(result).to_be_instance_of(LoaderResult)
     expect(result.buffer).to_equal("body")