mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
43 lines
1.1 KiB
Python
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
|