@@ -147,7 +147,7 @@ def test_add_record_set(self):
147147 zone = _Zone ()
148148 changes = self ._make_one (zone )
149149 rrs = ResourceRecordSet (
150- "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], zone
150+ "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], {}, zone
151151 )
152152 changes .add_record_set (rrs )
153153 self .assertEqual (list (changes .additions ), [rrs ])
@@ -165,7 +165,7 @@ def test_delete_record_set(self):
165165 zone = _Zone ()
166166 changes = self ._make_one (zone )
167167 rrs = ResourceRecordSet (
168- "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], zone
168+ "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], {}, zone
169169 )
170170 changes .delete_record_set (rrs )
171171 self .assertEqual (list (changes .deletions ), [rrs ])
@@ -195,12 +195,12 @@ def test_create_w_bound_client(self):
195195 changes = self ._make_one (zone )
196196 changes .add_record_set (
197197 ResourceRecordSet (
198- "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], zone
198+ "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], {}, zone
199199 )
200200 )
201201 changes .delete_record_set (
202202 ResourceRecordSet (
203- "test.example.com" , "CNAME" , 86400 , ["other.example.com" ], zone
203+ "test.example.com" , "CNAME" , 86400 , ["other.example.com" ], {}, zone
204204 )
205205 )
206206
@@ -228,12 +228,12 @@ def test_create_w_alternate_client(self):
228228 changes = self ._make_one (zone )
229229 changes .add_record_set (
230230 ResourceRecordSet (
231- "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], zone
231+ "test.example.com" , "CNAME" , 3600 , ["www.example.com" ], {}, zone
232232 )
233233 )
234234 changes .delete_record_set (
235235 ResourceRecordSet (
236- "test.example.com" , "CNAME" , 86400 , ["other.example.com" ], zone
236+ "test.example.com" , "CNAME" , 86400 , ["other.example.com" ], {}, zone
237237 )
238238 )
239239
@@ -339,6 +339,40 @@ def test_reload_w_alternate_client(self):
339339 self .assertEqual (req ["path" ], "/%s" % PATH )
340340 self ._verifyResourceProperties (changes , RESOURCE , zone )
341341
342+ def test__routing_policy_cleaner_falsy (self ):
343+ conn = _Connection ()
344+ client = _Client (project = self .PROJECT , connection = conn )
345+ zone = _Zone (client )
346+ changes = self ._make_one (zone )
347+ resource_dict = {
348+ "name" : "test.example.com" ,
349+ "type" : "A" ,
350+ "ttl" : 3600 ,
351+ "rrdatas" : [],
352+ "routingPolicy" : {},
353+ }
354+
355+ cleaned = changes ._routing_policy_cleaner (resource_dict )
356+ self .assertTrue ("rrdatas" not in cleaned )
357+ self .assertTrue ("routingPolicy" not in cleaned )
358+
359+ def test__routing_policy_cleaner_truthy (self ):
360+ conn = _Connection ()
361+ client = _Client (project = self .PROJECT , connection = conn )
362+ zone = _Zone (client )
363+ changes = self ._make_one (zone )
364+ resource_dict = {
365+ "name" : "test.example.com" ,
366+ "type" : "A" ,
367+ "ttl" : 3600 ,
368+ "rrdatas" : ["10.1.2.3" ],
369+ "routingPolicy" : {"geo" : {}},
370+ }
371+
372+ cleaned = changes ._routing_policy_cleaner (resource_dict )
373+ self .assertTrue ("rrdatas" in cleaned )
374+ self .assertTrue ("routingPolicy" in cleaned )
375+
342376
343377class _Zone (object ):
344378 def __init__ (
0 commit comments