-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat secdist: implement inline config
commit_hash:daed0ddfcb4658e09eeb5e12ac15eede3397715c
- Loading branch information
Showing
11 changed files
with
90 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
core/functional_tests/https/tests-secdist-inline/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import aiohttp | ||
import pytest | ||
|
||
pytest_plugins = ['pytest_userver.plugins.core'] | ||
USERVER_CONFIG_HOOKS = ['userver_config_secdist'] | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def userver_config_secdist(userver_config_http_client, service_source_dir): | ||
def patch_config(config_yaml, config_vars) -> None: | ||
components = config_yaml['components_manager']['components'] | ||
|
||
tls = components['server']['listener']['tls'] | ||
tls['cert'] = str(service_source_dir / 'cert.crt') | ||
tls['private-key'] = str(service_source_dir / 'private_key.key') | ||
|
||
if 'config' in components['default-secdist-provider']: | ||
del components['default-secdist-provider']['config'] | ||
components['default-secdist-provider']['inline'] = { | ||
'passphrases': {'tls': 'asd'}, | ||
} | ||
|
||
return patch_config | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def service_baseurl(service_port) -> str: | ||
return f'https://localhost:{service_port}/' | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def service_client_session_factory(event_loop, service_source_dir): | ||
def make_session(**kwargs): | ||
kwargs.setdefault('loop', event_loop) | ||
kwargs['connector'] = aiohttp.TCPConnector(verify_ssl=False) | ||
return aiohttp.ClientSession(**kwargs) | ||
|
||
return make_session |
3 changes: 3 additions & 0 deletions
3
core/functional_tests/https/tests-secdist-inline/test_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async def test_ping(service_client): | ||
response = await service_client.get('ping') | ||
assert response.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters