def test_download_s3_object_bucket_exception(self, mock_logger): # pylint: disable=no-self-use """LookupTables - S3 bucket doesn't exist""" lookup_tables = LookupTables({'wrong_bucket': ['foo.json']}) lookup_tables.download_s3_objects() mock_logger.assert_called_with( 'Encounterred error while downloading %s from %s, %s', 'foo.json', 'wrong_bucket', 'The specified bucket does not exist')
def setup(self): """LookupTables - Setup S3 bucket mocking""" # pylint: disable=attribute-defined-outside-init self.config = load_config('tests/unit/conf') self.lookup_tables = LookupTables(self.buckets_info) self.s3_mock = mock_s3() self.s3_mock.start() for bucket, files in self.buckets_info.iteritems(): for json_file in files: put_mock_s3_object( bucket, json_file, json.dumps({ '{}_key'.format(bucket): '{}_value'.format(os.path.splitext(json_file)[0]) }), self.region)
def test_download_s3_object_file_exception(self): # pylint: disable=no-self-use """LookupTables - S3 file doesn't exist""" lookup_tables = LookupTables({'bucket_name': ['wrong_file']}) lookup_tables.download_s3_objects()