add test_api_config_test

This commit is contained in:
Dmitry Belyaev 2021-09-22 14:55:44 +03:00
parent 92d495dfd5
commit 27ab87a7a2
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -14,6 +14,9 @@ def temp_config(tmpdir) -> str:
apache_config = tmpdir.join('apache.cfg') apache_config = tmpdir.join('apache.cfg')
apache_config.write('#start\n') apache_config.write('#start\n')
flagfile = tmpdir.join('apache_restart') flagfile = tmpdir.join('apache_restart')
platform_path = tmpdir.mkdir('platform')
ws_module = 'wsap24.so'
platform_path.join(ws_module).write('\0')
with open(configfile, 'w') as f: with open(configfile, 'w') as f:
yaml.dump({ yaml.dump({
@ -21,8 +24,8 @@ def temp_config(tmpdir) -> str:
'vrd_path': str(vrd_path), 'vrd_path': str(vrd_path),
'dir_path': str(dir_path), 'dir_path': str(dir_path),
'url_base': '/1c', 'url_base': '/1c',
'platform_path': '/opt/1cv8/x86_64/current', 'platform_path': str(platform_path),
'ws_module': 'wsap24.so', 'ws_module': ws_module,
'vrd_params': { 'vrd_params': {
'debug': None, 'debug': None,
'server_addr': 'localhost' 'server_addr': 'localhost'
@ -72,3 +75,15 @@ def test_api_restart_flag(client):
response = client.get(endpoint) response = client.get(endpoint)
assert 200 == response.status_code assert 200 == response.status_code
def test_api_config_test(client):
response = client.get('/api/v1/config-test')
data = response.get_json()
assert data == {
'is_apache_cfg_valid': True,
'is_vrd_path_valid': True,
'is_dir_path_valid': True,
'is_url_base_valid': True,
'is_module_valid': True,
}