#NEWLINE# @ mock_route53 #NEWLINE# def test_rrset( ) : #NEWLINE# #INDENT# conn = boto . connect_route53 ( 'the_key' , 'the_secret' ) #NEWLINE# conn . get_all_rrsets . when . called_with ( 'abcd' , type = 'A' ) . should . throw ( boto . route53 . exception . DNSServerError , '404 Not Found' ) #NEWLINE# zone = conn . create_hosted_zone ( 'testdns.aws.com' ) #NEWLINE# zoneid = zone [ 'CreateHostedZoneResponse' ] [ 'HostedZone' ] [ 'Id' ] . split ( '/' ) [ ( - 1 ) ] #NEWLINE# changes = ResourceRecordSets ( conn , changes ) #NEWLINE# change = changes . add_change ( 'CREATE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '1.2.3.4' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '1.2.3.4' ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'CNAME' ) #NEWLINE# rrsets . should . have . length_of ( 0 ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# changes . add_change ( 'DELETE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change = changes . add_change ( 'CREATE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '5.6.7.8' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '5.6.7.8' ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# changes . add_change ( 'DELETE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid ) #NEWLINE# rrsets . should . have . length_of ( 0 ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# change = changes . add_change ( 'UPSERT' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '1.2.3.4' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '1.2.3.4' ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# change = changes . add_change ( 'UPSERT' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '5.6.7.8' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '5.6.7.8' ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# changes . add_change ( 'DELETE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# changes . commit ( ) #NEWLINE# changes = ResourceRecordSets ( conn , zoneid ) #NEWLINE# change = changes . add_change ( 'CREATE' , 'foo.bar.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '1.2.3.4' ) #NEWLINE# change = changes . add_change ( 'CREATE' , 'bar.foo.testdns.aws.com' , 'A' ) #NEWLINE# change . add_value ( '5.6.7.8' ) #NEWLINE# changes . commit ( ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 2 ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , name = 'foo.bar.testdns.aws.com' , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '1.2.3.4' ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , name = 'bar.foo.testdns.aws.com' , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 1 ) #NEWLINE# rrsets [ 0 ] . resource_records [ 0 ] . should . equal ( '5.6.7.8' ) #NEWLINE# rrsets = conn . get_all_rrsets ( zoneid , name = 'foo.foo.testdns.aws.com' , type = 'A' ) #NEWLINE# rrsets . should . have . length_of ( 0 )