Comments (7)
Ah just to let you know, those are some knowledge tests that I write to the test the loader (my main case is a loader related case) as well:
import os
from contextvars import ContextVar
import aiobotocore.session
import pytest
import pytest_asyncio
from derpconf.config import Config
from thumbor.context import Context
from tc_aws.loaders import s3_loader
from tests import start_service
from .fixtures.storage_fixture import IMAGE_PATH, IMAGE_BYTES, s3_bucket
MOTO_PROCCESS = ContextVar('moto_proccess', default=None)
@pytest_asyncio.fixture
def session():
return aiobotocore.session.get_session()
@pytest.fixture
def moto_server():
if not MOTO_PROCCESS.get():
os.environ['AWS_SHARED_CREDENTIALS_FILE'] = ''
os.environ['AWS_ACCESS_KEY_ID'] = 'test-key'
os.environ['AWS_SECRET_ACCESS_KEY'] = 'test-secret-key'
os.environ['AWS_SESSION_TOKEN'] = 'test-session-token'
moto_pid = start_service("localhost", 5000)
MOTO_PROCCESS.set(moto_pid)
@pytest.fixture
def tc_aws_config():
return Config(
TC_AWS_LOADER_BUCKET=s3_bucket,
TC_AWS_LOADER_ROOT_PATH='root_path',
TC_AWS_REGION='us-east-1',
TC_AWS_ENDPOINT="http://localhost:5000"
)
@pytest.mark.asyncio
async def test_test_can_load_image_from_s3(moto_server, session, tc_aws_config):
async with session.create_client('s3',
**{'region_name': 'us-east-1', 'endpoint_url': "http://localhost:5000"}) as client:
await client.create_bucket(Bucket=s3_bucket)
await client.put_object(
Bucket=s3_bucket,
Key=''.join(['root_path', IMAGE_PATH]),
Body=IMAGE_BYTES,
ContentType='image/jpeg')
loader_result = await s3_loader.load(Context(config=tc_aws_config), IMAGE_PATH)
assert loader_result
from aws.
Hi @gcavalcante8808 and thanks for reporting this. Could you submit your devs as a pull request here? We'll review it and see that it gets integrated :)
from aws.
As I started the branch from the commit/tag 7.0.1b
, the changes between the current repo master and the branch improvement/use-botocore-2-2-0-to-support-assume-role-credentials
(in my forked repo) are slightly far from those that I made in the branch.
Hi @Bladrak, with this in mind I ask: what branch Do I target with the PR?
from aws.
@gcavalcante8808 hi, can you target the py3
branch?
from aws.
I would like to see aiobotocore get an update as well. I have just tried to upgrade from Thumbor 6.x to 7.0.8 using 7.0.1b0 of this plugin, and I am seeing cannot pickle 'coroutine' object exceptions, which seem to be related to this.
The exception looks similar to what was reported to aiobotocore in aio-libs/aiobotocore#779 and that was fixed in version 1.0.0.
from aws.
An update to this issue would be very welcome.
from aws.
+1
from aws.
Related Issues (20)
- Remove dependency to tornado_botocore
- Cannot DELETE when TC_AWS_RANDOMIZE_KEYS = True HOT 2
- Credentials not found when using IAM role for EC2 instance HOT 1
- Cannot load files from s3 bucket HOT 1
- S3 key not found at HOT 2
- Plan to support customized result storage path?
- thumbor s3 upload
- Multiple TC_AWS_LOADER_BUCKET HOT 2
- Delete file from S3 fails because of missing normalization HOT 6
- Cannot load files from S3 bucket larger than 100mb HOT 1
- Support thumbor v7.x. HOT 25
- Getting "No security key was found" HOT 2
- Migrating from old version: 404 on old images HOT 2
- Feature request: modify S3 result storage path to make for easier deletion HOT 2
- Need Help with Configuration HOT 1
- Images are not complete when getting it from server HOT 1
- Help to upgrade this to 7.0.0 HOT 1
- Thumbor watermark Filters shows multiple image(2 watermark image)
- Feature Request - Multiple S3 bucket support for image loader piece HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws.