Skip to content

Commit 45f4678

Browse files
authored
fix: renames zone_id to zone_config_id in Record model (#11)
The implementation used zone_id as provided in the official documentation. However, zone_config_id is the correct field that is sent by the API to the client and must be parsed instead.
1 parent 0f26d87 commit 45f4678

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

hostingde/model/record.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Record(Model):
4141
"""The DNS Record object is part of a zone. It is used to manage DNS resource records."""
4242

4343
id: Optional[str]
44-
zone_id: Optional[str]
44+
zone_config_id: Optional[str]
4545
record_template_id: Optional[str]
4646
name: Optional[str]
4747
content: Optional[str]
@@ -54,7 +54,7 @@ class Record(Model):
5454
def __init__(
5555
self,
5656
id: Optional[str] = None,
57-
zone_id: Optional[str] = None,
57+
zone_config_id: Optional[str] = None,
5858
record_template_id: Optional[str] = None,
5959
name: Optional[str] = None,
6060
type: Optional[RecordType] = None,
@@ -71,7 +71,7 @@ def __init__(
7171
:param id: Record ID. Ignored in create zone requzone_config.pyests. Either id or zoneId, name,
7272
type, and content are required in all other requests.
7373
74-
:param zone_id: ID of zone that the record belongs to.
74+
:param zone_config_id: ID of zone that the record belongs to.
7575
7676
:param record_template_id: ID of record template the record is tied to. If empty, record has to be managed
7777
manually. If tied to record template, record will be removed or updated whenever
@@ -101,7 +101,7 @@ def __init__(
101101
"""
102102
super().__init__(**kwargs)
103103
self.id = id
104-
self.zone_id = zone_id
104+
self.zone_config_id = zone_config_id
105105
self.record_template_id = record_template_id
106106
self.name = name
107107
self.type = type

tests/unit/model/test_record.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_record_constructor():
3232
def test_parse_record():
3333
data = dict(
3434
id='234987fds',
35-
zoneId="wegsefgio345235",
35+
zoneConfigId="wegsefgio345235",
3636
recordTemplateId="templateid",
3737
name="recordname",
3838
type="A",
@@ -45,7 +45,7 @@ def test_parse_record():
4545
record = Record.from_json(data)
4646

4747
assert record.id == '234987fds'
48-
assert record.zone_id == "wegsefgio345235"
48+
assert record.zone_config_id == "wegsefgio345235"
4949
assert record.record_template_id == "templateid"
5050
assert record.name == "recordname"
5151
assert record.type == RecordType.A
@@ -58,7 +58,7 @@ def test_parse_record():
5858
def test_dump_record():
5959
record = Record(
6060
id='234987fds',
61-
zone_id="wegsefgio345235",
61+
zone_config_id="wegsefgio345235",
6262
record_template_id="templateid",
6363
name="recordname",
6464
type=RecordType.A,
@@ -70,7 +70,7 @@ def test_dump_record():
7070

7171
assert record.to_json() == dict(
7272
id='234987fds',
73-
zoneId="wegsefgio345235",
73+
zoneConfigId="wegsefgio345235",
7474
recordTemplateId="templateid",
7575
name="recordname",
7676
type="A",
@@ -91,6 +91,6 @@ def test_create_new_record():
9191
assert record.ttl == 86400
9292
assert record.priority is None
9393

94-
assert record.zone_id is None
94+
assert record.zone_config_id is None
9595
assert record.record_template_id is None
9696
assert record.last_change_date is None

0 commit comments

Comments
 (0)