@@ -16,10 +16,14 @@ def test_ttl_to_proxy(self):
16
16
with_ttl = Record .new (
17
17
zone , 'good' , {'type' : 'A' , 'ttl' : 0 , 'value' : '1.2.3.4' }
18
18
)
19
+ with_ttl_type_other = Record .new (
20
+ zone , 'ttl-only' , {'type' : 'TXT' , 'ttl' : 0 , 'value' : 'acme' }
21
+ )
19
22
without_ttl = Record .new (
20
23
zone , 'bad' , {'type' : 'A' , 'ttl' : 10 , 'value' : '1.2.3.4' }
21
24
)
22
25
zone .add_record (with_ttl )
26
+ zone .add_record (with_ttl_type_other )
23
27
zone .add_record (without_ttl )
24
28
25
29
expected_with = Record .new (
@@ -32,10 +36,21 @@ def test_ttl_to_proxy(self):
32
36
'_octodns' : {'cloudflare' : {'proxied' : True , 'auto-ttl' : True }},
33
37
},
34
38
)
39
+ expected_with_ttl_only = Record .new (
40
+ zone ,
41
+ 'ttl-only' ,
42
+ {
43
+ 'type' : 'TXT' ,
44
+ 'ttl' : 0 ,
45
+ 'value' : '1.2.3.4' ,
46
+ '_octodns' : {'cloudflare' : {'auto-ttl' : True }},
47
+ },
48
+ )
35
49
expected_without = Record .new (
36
50
zone , 'bad' , {'type' : 'A' , 'ttl' : 10 , 'value' : '1.2.3.4' }
37
51
)
38
52
zone_expected .add_record (expected_with )
53
+ zone_expected .add_record (expected_with_ttl_only )
39
54
zone_expected .add_record (expected_without )
40
55
41
56
added_proxy = processor .process_source_zone (zone )
@@ -45,6 +60,9 @@ def test_ttl_to_proxy(self):
45
60
self .assertEqual (
46
61
{'cloudflare' : {'proxied' : True , 'auto-ttl' : True }}, good ._octodns
47
62
)
63
+ ttl_only = next (r for r in added_proxy .records if r .name == 'ttl-only' )
64
+ self .assertEqual (1 , good .ttl )
65
+ self .assertEqual ({'cloudflare' : {'auto-ttl' : True }}, ttl_only ._octodns )
48
66
bad = next (r for r in added_proxy .records if r .name == 'bad' )
49
67
self .assertEqual (10 , bad .ttl )
50
68
self .assertFalse ('cloudflare' in bad ._octodns )
0 commit comments