blob: 478fdd79917dc9777c6fb761c4adbdd86b08dc07 (
plain)
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
|
import os
import time
import json
import signal
import pytest
from dotenv import load_dotenv
import fatcat_web
import fatcat_client
from fatcat_tools import authenticated_api
@pytest.fixture
def full_app():
load_dotenv(dotenv_path="./example.env")
fatcat_web.app.testing = True
fatcat_web.app.debug = False
fatcat_web.app.config['WTF_CSRF_ENABLED'] = False
return fatcat_web.app
@pytest.fixture
def app(full_app):
return full_app.test_client()
@pytest.fixture
def app_admin(app):
ADMIN_DEV_TOKEN = "AgEPZGV2LmZhdGNhdC53aWtpAhYyMDE5MDEwMS1kZXYtZHVtbXkta2V5AAImZWRpdG9yX2lkID0gYWFhYWFhYWFhYWFhYmt2a2FhYWFhYWFhYWkAAht0aW1lID4gMjAxOS0wNC0wNFQyMzozMjo0NloAAAYgrN3jjy0mgEqIydTFfsOLYSS55dz6Fh2d1CGMNQFLwcQ="
rv = app.post('/auth/token_login',
data=dict(token=ADMIN_DEV_TOKEN),
follow_redirects=True)
assert rv.status_code == 200
return app
@pytest.fixture
def api():
load_dotenv(dotenv_path="./example.env")
api_client = authenticated_api("http://localhost:9411/v0")
api_client.editor_id = "aaaaaaaaaaaabkvkaaaaaaaaae"
return api_client
def test_get_changelog_entry(api):
"""Check that fixture is working"""
cl = api.get_changelog_entry(1)
assert cl
## Helpers ##################################################################
def quick_eg(api_inst):
eg = api_inst.create_editgroup(fatcat_client.Editgroup())
return eg
|