|
| 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