1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Implement black formatting

This commit is contained in:
Ross McFarland
2022-07-04 12:27:39 -07:00
parent 392d8b516f
commit e116d26eec
101 changed files with 6403 additions and 5490 deletions

View File

@@ -2,8 +2,12 @@
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
from unittest import TestCase
@@ -24,103 +28,96 @@ class TestTinyDnsFileSource(TestCase):
expected = Zone('example.com.', [])
for name, data in (
('', {
'type': 'A',
'ttl': 30,
'values': ['10.2.3.4', '10.2.3.5'],
}),
('', {
'type': 'NS',
'ttl': 3600,
'values': ['ns1.ns.com.', 'ns2.ns.com.'],
}),
('sub', {
'type': 'NS',
'ttl': 30,
'values': ['ns3.ns.com.', 'ns4.ns.com.'],
}),
('www', {
'type': 'A',
'ttl': 3600,
'value': '10.2.3.6',
}),
('cname', {
'type': 'CNAME',
'ttl': 3600,
'value': 'www.example.com.',
}),
('some-host-abc123', {
'type': 'A',
'ttl': 1800,
'value': '10.2.3.7',
}),
('has-dup-def123', {
'type': 'A',
'ttl': 3600,
'value': '10.2.3.8',
}),
('www.sub', {
'type': 'A',
'ttl': 3600,
'value': '1.2.3.4',
}),
('has-dup-def456', {
'type': 'A',
'ttl': 3600,
'value': '10.2.3.8',
}),
('', {
'type': 'MX',
'ttl': 3600,
'values': [{
'preference': 10,
'exchange': 'smtp-1-host.example.com.',
}, {
'preference': 20,
'exchange': 'smtp-2-host.example.com.',
}]
}),
('smtp', {
'type': 'MX',
'ttl': 1800,
'values': [{
'preference': 30,
'exchange': 'smtp-1-host.example.com.',
}, {
'preference': 40,
'exchange': 'smtp-2-host.example.com.',
}]
}),
('', {
'type': 'TXT',
'ttl': 300,
'value': 'test TXT',
}),
('colon', {
'type': 'TXT',
'ttl': 300,
'value': 'test : TXT',
}),
('nottl', {
'type': 'TXT',
'ttl': 3600,
'value': 'nottl test TXT',
}),
('ipv6-3', {
'type': 'AAAA',
'ttl': 300,
'value': '2a02:1348:017c:d5d0:0024:19ff:fef3:5742',
}),
('ipv6-6', {
'type': 'AAAA',
'ttl': 3600,
'value': '2a02:1348:017c:d5d0:0024:19ff:fef3:5743',
}),
('semicolon', {
'type': 'TXT',
'ttl': 300,
'value': 'v=DKIM1\\; k=rsa\\; p=blah',
}),
('', {'type': 'A', 'ttl': 30, 'values': ['10.2.3.4', '10.2.3.5']}),
(
'',
{
'type': 'NS',
'ttl': 3600,
'values': ['ns1.ns.com.', 'ns2.ns.com.'],
},
),
(
'sub',
{
'type': 'NS',
'ttl': 30,
'values': ['ns3.ns.com.', 'ns4.ns.com.'],
},
),
('www', {'type': 'A', 'ttl': 3600, 'value': '10.2.3.6'}),
(
'cname',
{'type': 'CNAME', 'ttl': 3600, 'value': 'www.example.com.'},
),
(
'some-host-abc123',
{'type': 'A', 'ttl': 1800, 'value': '10.2.3.7'},
),
('has-dup-def123', {'type': 'A', 'ttl': 3600, 'value': '10.2.3.8'}),
('www.sub', {'type': 'A', 'ttl': 3600, 'value': '1.2.3.4'}),
('has-dup-def456', {'type': 'A', 'ttl': 3600, 'value': '10.2.3.8'}),
(
'',
{
'type': 'MX',
'ttl': 3600,
'values': [
{
'preference': 10,
'exchange': 'smtp-1-host.example.com.',
},
{
'preference': 20,
'exchange': 'smtp-2-host.example.com.',
},
],
},
),
(
'smtp',
{
'type': 'MX',
'ttl': 1800,
'values': [
{
'preference': 30,
'exchange': 'smtp-1-host.example.com.',
},
{
'preference': 40,
'exchange': 'smtp-2-host.example.com.',
},
],
},
),
('', {'type': 'TXT', 'ttl': 300, 'value': 'test TXT'}),
('colon', {'type': 'TXT', 'ttl': 300, 'value': 'test : TXT'}),
('nottl', {'type': 'TXT', 'ttl': 3600, 'value': 'nottl test TXT'}),
(
'ipv6-3',
{
'type': 'AAAA',
'ttl': 300,
'value': '2a02:1348:017c:d5d0:0024:19ff:fef3:5742',
},
),
(
'ipv6-6',
{
'type': 'AAAA',
'ttl': 3600,
'value': '2a02:1348:017c:d5d0:0024:19ff:fef3:5743',
},
),
(
'semicolon',
{
'type': 'TXT',
'ttl': 300,
'value': 'v=DKIM1\\; k=rsa\\; p=blah',
},
),
):
record = Record.new(expected, name, data)
expected.add_record(record)
@@ -135,11 +132,7 @@ class TestTinyDnsFileSource(TestCase):
expected = Zone('asdf.subtest.com.', [])
for name, data in (
('a3', {
'type': 'A',
'ttl': 3600,
'values': ['10.2.3.7'],
}),
('a3', {'type': 'A', 'ttl': 3600, 'values': ['10.2.3.7']}),
):
record = Record.new(expected, name, data)
expected.add_record(record)
@@ -154,16 +147,8 @@ class TestTinyDnsFileSource(TestCase):
expected = Zone('sub-asdf.subtest.com.', [])
for name, data in (
('a1', {
'type': 'A',
'ttl': 3600,
'values': ['10.2.3.5'],
}),
('a2', {
'type': 'A',
'ttl': 3600,
'values': ['10.2.3.6'],
}),
('a1', {'type': 'A', 'ttl': 3600, 'values': ['10.2.3.5']}),
('a2', {'type': 'A', 'ttl': 3600, 'values': ['10.2.3.6']}),
):
record = Record.new(expected, name, data)
expected.add_record(record)
@@ -178,26 +163,24 @@ class TestTinyDnsFileSource(TestCase):
expected = Zone('3.2.10.in-addr.arpa.', [])
for name, data in (
('10', {
'type': 'PTR',
'ttl': 3600,
'value': 'a-ptr.example.com.'
}),
('11', {
'type': 'PTR',
'ttl': 30,
'value': 'a-ptr-2.example.com.'
}),
('8', {
'type': 'PTR',
'ttl': 3600,
'value': 'has-dup-def123.example.com.'
}),
('7', {
'type': 'PTR',
'ttl': 1800,
'value': 'some-host-abc123.example.com.'
}),
('10', {'type': 'PTR', 'ttl': 3600, 'value': 'a-ptr.example.com.'}),
('11', {'type': 'PTR', 'ttl': 30, 'value': 'a-ptr-2.example.com.'}),
(
'8',
{
'type': 'PTR',
'ttl': 3600,
'value': 'has-dup-def123.example.com.',
},
),
(
'7',
{
'type': 'PTR',
'ttl': 1800,
'value': 'some-host-abc123.example.com.',
},
),
):
record = Record.new(expected, name, data)
expected.add_record(record)