-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
56 lines (45 loc) · 1.18 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Some fixtures for testing the tucuxi module"""
import boto3
import pytest
from moto import mock_s3
from moto import mock_sqs
@pytest.fixture
def objs():
"""[summary]
Returns:
[type]: [description]
"""
return [
{"key": "TEST/teste_object.json", "data": "TEST DATA"},
{"key": "TEST/teste_object2.json", "data": "TEST DATA 2"},
]
@pytest.fixture(scope="session")
def s3_name(request):
"""[summary]
Args:
request ([type]): [description]
Returns:
[type]: [description]
"""
bucket_name = "test.bucket"
mock = mock_s3()
mock.start()
conn = boto3.resource("s3", region_name="us-east-1")
conn.create_bucket(Bucket=bucket_name)
request.addfinalizer(mock.stop)
return bucket_name
@pytest.fixture(scope="session")
def sqs_url(request):
"""[summary]
Args:
request ([type]): [description]
Returns:
[type]: [description]
"""
queue_name = "test_queue"
mock = mock_sqs()
mock.start()
conn = boto3.resource("sqs", region_name="us-east-1")
queue_url = conn.create_queue(QueueName=queue_name).url
request.addfinalizer(mock.stop)
return queue_url