-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathtest_domain.py
More file actions
49 lines (41 loc) · 1.33 KB
/
test_domain.py
File metadata and controls
49 lines (41 loc) · 1.33 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
43
44
45
46
47
48
49
from __future__ import annotations
from datetime import datetime, timezone
import pytest
from hcloud.isos import Iso
@pytest.mark.parametrize(
"value",
[
(Iso(id=1),),
],
)
def test_eq(value):
assert value == value
class TestIso:
@pytest.fixture()
def deprecated_iso(self):
return Iso(
**{
"id": 10433,
"name": "vyos-1.4-rolling-202111150317-amd64.iso",
"description": "VyOS 1.4 (amd64)",
"type": "public",
"deprecation": {
"announced": "2023-10-05T08:27:01Z",
"unavailable_after": "2023-11-05T08:27:01Z",
},
"architecture": "x86",
"deprecated": "2023-11-05T08:27:01Z",
}
)
def test_deprecation(self, deprecated_iso: Iso):
with pytest.deprecated_call():
assert deprecated_iso.deprecated == datetime(
2023, 11, 5, 8, 27, 1, tzinfo=timezone.utc
)
assert deprecated_iso.deprecation is not None
assert deprecated_iso.deprecation.announced == datetime(
2023, 10, 5, 8, 27, 1, tzinfo=timezone.utc
)
assert deprecated_iso.deprecation.unavailable_after == datetime(
2023, 11, 5, 8, 27, 1, tzinfo=timezone.utc
)