Skip to content

Commit ae835d6

Browse files
committed
fix: formatting
1 parent 8617ab2 commit ae835d6

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

powerdns_api_proxy/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def validate_token(cls, token_sha512):
7474
raise ValueError("A SHA512 hash must be 128 digits long")
7575
return token_sha512
7676

77-
@model_validator(mode='after')
77+
@model_validator(mode="after")
7878
def validate_zones_or_global_read_only(self):
7979
if not self.zones and not self.global_read_only:
8080
raise ValueError(
@@ -84,7 +84,7 @@ def validate_zones_or_global_read_only(self):
8484

8585
def __init__(self, **data):
8686
super().__init__(**data)
87-
87+
8888
# populate zones lookup
8989
for zone in self.zones:
9090
self._zones_lookup[zone.name] = zone

tests/unit/config_test.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def test_global_read_only_without_zones():
602602
env = ProxyConfigEnvironment(
603603
name="Test Global Read Only",
604604
token_sha512=dummy_proxy_environment_token_sha512,
605-
global_read_only=True
605+
global_read_only=True,
606606
)
607607
assert env.global_read_only is True
608608
assert env.zones == []
@@ -612,21 +612,22 @@ def test_environment_with_neither_zones_nor_global_read_only_fails():
612612
"""Test that providing neither zones nor global_read_only fails validation"""
613613
with pytest.raises(ValueError) as err:
614614
ProxyConfigEnvironment(
615-
name="test",
616-
token_sha512=dummy_proxy_environment_token_sha512
615+
name="test", token_sha512=dummy_proxy_environment_token_sha512
617616
)
618-
assert "Either 'zones' must be non-empty or 'global_read_only' must be True" in str(err.value)
617+
assert "Either 'zones' must be non-empty or 'global_read_only' must be True" in str(
618+
err.value
619+
)
619620

620621

621622
def test_environment_with_empty_zones_and_no_global_read_only_fails():
622623
"""Test that explicitly providing empty zones without global_read_only fails"""
623624
with pytest.raises(ValueError) as err:
624625
ProxyConfigEnvironment(
625-
name="test",
626-
token_sha512=dummy_proxy_environment_token_sha512,
627-
zones=[]
626+
name="test", token_sha512=dummy_proxy_environment_token_sha512, zones=[]
628627
)
629-
assert "Either 'zones' must be non-empty or 'global_read_only' must be True" in str(err.value)
628+
assert "Either 'zones' must be non-empty or 'global_read_only' must be True" in str(
629+
err.value
630+
)
630631

631632

632633
def test_proxy_config_with_global_read_only_environment():
@@ -638,9 +639,9 @@ def test_proxy_config_with_global_read_only_environment():
638639
ProxyConfigEnvironment(
639640
name="foo",
640641
token_sha512=dummy_proxy_environment_token_sha512,
641-
global_read_only=True
642+
global_read_only=True,
642643
)
643-
]
644+
],
644645
)
645646
assert config.environments[0].global_read_only is True
646647
assert config.environments[0].zones == []
@@ -651,21 +652,21 @@ def test_global_read_only_with_explicit_zones_keeps_zone_permissions():
651652
# Create a zone that should remain writable
652653
writable_zone = ProxyConfigZone(name="example.com", read_only=False)
653654
readonly_zone = ProxyConfigZone(name="readonly.com", read_only=True)
654-
655+
655656
env = ProxyConfigEnvironment(
656657
name="Test Global Read Only with Zones",
657658
token_sha512=dummy_proxy_environment_token_sha512,
658659
zones=[writable_zone, readonly_zone],
659-
global_read_only=True
660+
global_read_only=True,
660661
)
661-
662+
662663
# global_read_only should be True
663664
assert env.global_read_only is True
664-
665+
665666
# But explicit zones should keep their original read_only settings
666667
assert env.zones[0].read_only is False # writable_zone should remain writable
667-
assert env.zones[1].read_only is True # readonly_zone should remain read_only
668-
668+
assert env.zones[1].read_only is True # readonly_zone should remain read_only
669+
669670
# Should have access to zones via lookup
670671
assert len(env._zones_lookup) == 2
671672
assert "example.com" in env._zones_lookup

0 commit comments

Comments
 (0)