Skip to content

Commit 03685d0

Browse files
committed
[chg] added tests
1 parent 67f793a commit 03685d0

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test:pytest-pylint:
1616
- poetry install
1717
# Conflicts with smbclient package
1818
- rm .venv/bin/smbclient.py || true
19-
- poetry run pytest
19+
- poetry run pytest -vv
2020
- poetry run pylint --disable=R,fixme opsideployclientagent
2121
- poetry run flake8 opsideployclientagent
2222

tests/test_addresses.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
test addresses
3+
4+
basic tests for address handling of DeployThreads
5+
"""
6+
7+
import pytest
8+
9+
from opsideployclientagent.common import DeployThread
10+
11+
BACKEND = None
12+
13+
14+
@pytest.mark.parametrize(
15+
"host, method, result_method",
16+
(
17+
("localhost.domain.local", "auto", "fqdn"),
18+
("127.0.0.1", "auto", "ip"),
19+
("localhost", "auto", "hostname"),
20+
("localhost.domain.local", "fqdn", "fqdn"),
21+
("127.0.0.1", "ip", "ip"),
22+
("localhost", "hostname", "hostname"),
23+
),
24+
)
25+
def test_detect_deployment_method(host, method, result_method):
26+
deploy_thread = DeployThread(
27+
host,
28+
BACKEND,
29+
"testuser",
30+
"testpassword",
31+
deployment_method=method,
32+
)
33+
assert deploy_thread.deployment_method == result_method
34+
35+
36+
@pytest.mark.parametrize(
37+
"host, result_host",
38+
(
39+
("localhost.domain.local", "localhost.domain.local"),
40+
("127.0.0.1", "localhost.domain.local"),
41+
("localhost", "localhost.domain.local"),
42+
),
43+
)
44+
def test_set_host_id(host, result_host):
45+
deploy_thread = DeployThread(
46+
host,
47+
BACKEND,
48+
"testuser",
49+
"testpassword",
50+
)
51+
assert deploy_thread.host == result_host

0 commit comments

Comments
 (0)