warpgate/tests/test_http_conntest.py
2022-09-02 14:00:08 +02:00

43 lines
1.1 KiB
Python

from textwrap import dedent
class Test:
def test_success(
self,
processes,
echo_server_port,
timeout,
):
proc, _ = processes.start_wg(
config=dedent(
f'''\
users: []
targets:
- name: target
allow_roles: [role]
http:
url: http://localhost:{echo_server_port}
'''
),
args=['test-target', 'target'],
)
proc.wait(timeout=timeout)
assert proc.returncode == 0
def test_fail_no_connection(self, processes, timeout):
proc, _ = processes.start_wg(
config=dedent(
'''\
users: []
targets:
- name: target
allow_roles: [role]
http:
url: http://localhostbaddomain
'''
),
args=['test-target', 'target'],
)
proc.wait(timeout=timeout)
assert proc.returncode != 0