mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
38 lines
952 B
Python
38 lines
952 B
Python
#
|
|
#
|
|
#
|
|
|
|
from unittest import TestCase
|
|
|
|
from octodns.record.chunked import _ChunkedValue
|
|
from octodns.record.spf import SpfRecord
|
|
from octodns.zone import Zone
|
|
|
|
|
|
class TestRecordChunked(TestCase):
|
|
def test_chunked_value_rdata_text(self):
|
|
for s in (
|
|
None,
|
|
'',
|
|
'word',
|
|
42,
|
|
42.43,
|
|
'1.2.3',
|
|
'some.words.that.here',
|
|
'1.2.word.4',
|
|
'1.2.3.4',
|
|
):
|
|
self.assertEqual(s, _ChunkedValue.parse_rdata_text(s))
|
|
|
|
# semi-colons are escaped
|
|
self.assertEqual(
|
|
'Hello\\; World!', _ChunkedValue.parse_rdata_text('Hello; World!')
|
|
)
|
|
|
|
# since we're always a string validate and __init__ don't
|
|
# parse_rdata_text
|
|
|
|
zone = Zone('unit.tests.', [])
|
|
a = SpfRecord(zone, 'a', {'ttl': 42, 'value': 'some.target.'})
|
|
self.assertEqual('some.target.', a.values[0].rdata_text)
|