userver: samples/digest_auth_service/tests/conftest.py
Loading...
Searching...
No Matches
samples/digest_auth_service/tests/conftest.py
1import pathlib
2
3import pytest
4
5from testsuite.databases.pgsql import discover
6
7pytest_plugins = ['pytest_userver.plugins.postgresql']
8
9
10@pytest.fixture(scope='session')
11def prepare_service_config():
12 def patch_config(config, config_vars):
13 pass
14
15 return patch_config
16
17
18@pytest.fixture(name='service_source_dir', scope='session')
19def _service_source_dir():
20 """Path to root directory service."""
21 return pathlib.Path(__file__).parent.parent
22
23
24@pytest.fixture(scope='session')
25def initial_data_path(service_source_dir):
26 """Path for find files with data"""
27 return [service_source_dir / 'postgresql/data']
28
29
30@pytest.fixture(scope='session')
31def pgsql_local(service_source_dir, pgsql_local_create):
32 """Create schemas databases for tests"""
33 databases = discover.find_schemas(
34 'auth', [service_source_dir.joinpath('postgresql/schemas')],
35 )
36 return pgsql_local_create(list(databases.values()))
37
38
39@pytest.fixture(scope='session')
40def service_env():
41 return {
42 'SERVER_DIGEST_AUTH_SECRET': (
43 '{ "http_server_digest_auth_secret": "some-private-key" }'
44 ),
45 }