This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconftest.py
73 lines (57 loc) · 1.44 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from grazyna.db import get_engine, create_database
from grazyna.test_mocks.sender import IrcSender
from grazyna.test_mocks.importer import Importer
from grazyna.request import RequestBot
from grazyna.irc.models import User
import pytest
@pytest.fixture()
def protocol():
return IrcSender()
@pytest.fixture()
def protocol_with_db():
client = IrcSender()
db_uri = client.config.get('main', 'db_uri')
client.db = get_engine(db_uri)
create_database(client.db)
return client
@pytest.fixture()
def protocol_with_importer():
client = IrcSender()
client.importer = Importer(client)
return client
@pytest.fixture
def public_bot(protocol):
return RequestBot(
protocol=protocol,
user=User('socek!a@b'),
chan='#czarnobyl',
private=False,
config={},
temp={},
)
@pytest.fixture
def public_bot_with_db(protocol_with_db):
return RequestBot(
protocol=protocol_with_db,
user=User('socek!a@b'),
chan='#czarnobyl',
private=False,
config={},
temp={},
)
@pytest.fixture
def private_bot(protocol):
return RequestBot(
protocol=protocol,
user=User('socek!a@b'),
private=True,
config={},
temp={},
)
@pytest.fixture
def bot_with_importer(protocol_with_importer):
return RequestBot(
protocol=protocol_with_importer,
user=User('socek!a@b'),
chan='#czarnobyl',
)