Beispiel #1
0
 def test_get_cached_exists(self, get_object, get_download):
     mock_object = mock.Mock()
     get_object.return_value = mock_object
     get_download.return_value = '/download'
     res = resource.get_cached_file('/candidate', b'', filename='download.csv')
     assert res == '/download'
     get_download.assert_called_once_with(mock_object, filename='download.csv')
Beispiel #2
0
 def test_get_cached_exists(self, get_object, get_download):
     mock_object = mock.Mock()
     get_object.return_value = mock_object
     get_download.return_value = '/download'
     res = resource.get_cached_file('/candidate', b'', filename='download.csv')
     assert res == '/download'
     get_download.assert_called_once_with(mock_object, filename='download.csv')
Beispiel #3
0
 def test_get_cached_not_exists(self, get_object):
     mock_object = mock.Mock()
     def get_metadata():
         raise ClientError({'Error': {}}, 'test')
     mock_metadata = mock.PropertyMock(side_effect=get_metadata)
     type(mock_object).metadata = mock_metadata
     get_object.return_value = mock_object
     res = resource.get_cached_file('/candidate', b'')
     assert res is None
Beispiel #4
0
 def test_get_cached_not_exists(self, get_object):
     mock_object = mock.Mock()
     def get_metadata():
         raise ClientError({'Error': {}}, 'test')
     mock_metadata = mock.PropertyMock(side_effect=get_metadata)
     type(mock_object).metadata = mock_metadata
     get_object.return_value = mock_object
     res = resource.get_cached_file('/candidate', b'')
     assert res is None