-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconftest.py
More file actions
39 lines (27 loc) · 914 Bytes
/
conftest.py
File metadata and controls
39 lines (27 loc) · 914 Bytes
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
import os
import tempfile
import pytest
from hubble.payment.client import PaymentClient
from .utils.stripe import StripeClient
@pytest.fixture(autouse=True)
def tmpfile(tmpdir):
tmpfile = f'jina_test_{next(tempfile._get_candidate_names())}.db'
return tmpdir / tmpfile
@pytest.fixture(scope='session')
def m2m_token():
return os.environ.get('M2M_TOKEN', None)
# fixture for acquiring a 'cached' instance of StripeClient
@pytest.fixture(scope='session')
def stripe_client():
api_key = os.environ.get('STRIPE_SECRET_KEY', None)
client = StripeClient(api_key)
yield client
client.cleanup()
@pytest.fixture()
def payment_client(m2m_token):
payment_client = PaymentClient(m2m_token=m2m_token)
yield payment_client
@pytest.fixture()
def user_token(payment_client, request):
user_token = payment_client.get_user_token(user_id=request.param)['data']
yield user_token