コード例 #1
0
ファイル: test_https_loader.py プロジェクト: Bladrak/thumbor
 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')
コード例 #2
0
 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')
コード例 #3
0
 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()
コード例 #4
0
ファイル: test_https_loader.py プロジェクト: Bladrak/thumbor
 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()
コード例 #5
0
 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)
コード例 #6
0
ファイル: test_https_loader.py プロジェクト: Bladrak/thumbor
 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)
コード例 #7
0
ファイル: https_loader_vows.py プロジェクト: xialisun/thumbor
 def topic(self, callback):
     mock = ResponseMock(body='body', code=200)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
コード例 #8
0
ファイル: https_loader_vows.py プロジェクト: xialisun/thumbor
 def topic(self, callback):
     mock = ResponseMock(error='Error', code=599)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
コード例 #9
0
ファイル: https_loader_vows.py プロジェクト: mstorus/thumbor
 def topic(self, callback):
     mock = ResponseMock(body='body', code=200)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)
コード例 #10
0
ファイル: https_loader_vows.py プロジェクト: mstorus/thumbor
 def topic(self, callback):
     mock = ResponseMock(error='Error', code=599)
     ctx = Context(None, None, None)
     return loader.return_contents(mock, 'some-url', callback, ctx)