-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_deployment_info_extensions.py
More file actions
42 lines (33 loc) · 1.17 KB
/
test_deployment_info_extensions.py
File metadata and controls
42 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import uuid
from thymis_controller import db_models
from thymis_controller.crud import deployment_info as crud
def _make_di(db_session):
di = db_models.DeploymentInfo(
ssh_public_key=f"ssh-ed25519 AAAA{uuid.uuid4().hex}",
deployed_config_id="cfg",
)
db_session.add(di)
db_session.commit()
db_session.refresh(di)
return di
def test_update_location(db_session):
di = _make_di(db_session)
updated = crud.update_location(db_session, di.id, "Server Room A")
assert updated.location == "Server Room A"
def test_update_location_to_none(db_session):
di = _make_di(db_session)
crud.update_location(db_session, di.id, "Old Location")
updated = crud.update_location(db_session, di.id, None)
assert updated.location is None
def test_update_stores_network_interfaces(db_session):
di = _make_di(db_session)
ifaces = [
{
"interface": "eth0",
"ipv4_addresses": ["192.168.1.1"],
"ipv6_addresses": [],
"mac_address": "aa:bb:cc:dd:ee:ff",
}
]
updated = crud.update(db_session, di.id, network_interfaces=ifaces)
assert updated.network_interfaces == ifaces