<s> import time <EOL> from tests . compat import unittest <EOL> from boto . route53 . connection import Route53Connection <EOL> from boto . route53 . record import ResourceRecordSets <EOL> from boto . route53 . exception import DNSServerError <EOL> class TestRoute53AliasResourceRecordSets ( unittest . TestCase ) : <EOL> route53 = True <EOL> def setUp ( self ) : <EOL> super ( TestRoute53AliasResourceRecordSets , self ) . setUp ( ) <EOL> self . conn = Route53Connection ( ) <EOL> self . base_domain = '<STR_LIT>' % str ( int ( time . time ( ) ) ) <EOL> self . zone = self . conn . create_zone ( self . base_domain ) <EOL> self . zone . add_a ( '<STR_LIT>' % self . base_domain , '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . zone . delete_a ( '<STR_LIT>' % self . base_domain ) <EOL> self . zone . delete ( ) <EOL> super ( TestRoute53AliasResourceRecordSets , self ) . tearDown ( ) <EOL> def test_incomplete_add_alias_failure ( self ) : <EOL> base_record = dict ( name = "<STR_LIT>" % self . base_domain , <EOL> type = "<STR_LIT:A>" , <EOL> alias_dns_name = "<STR_LIT>" % self . base_domain , <EOL> alias_hosted_zone_id = self . zone . id , <EOL> identifier = "<STR_LIT>" ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> try : <EOL> self . assertRaises ( DNSServerError , rrs . commit ) <EOL> except : <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> rrs . commit ( ) <EOL> raise <EOL> def test_add_alias ( self ) : <EOL> base_record = dict ( name = "<STR_LIT>" % self . base_domain , <EOL> type = "<STR_LIT:A>" , <EOL> alias_evaluate_target_health = False , <EOL> alias_dns_name = "<STR_LIT>" % self . base_domain , <EOL> alias_hosted_zone_id = self . zone . id , <EOL> identifier = "<STR_LIT>" ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> rrs . commit ( ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> rrs . commit ( ) <EOL> def test_set_alias ( self ) : <EOL> base_record = dict ( name = "<STR_LIT>" % self . base_domain , <EOL> type = "<STR_LIT:A>" , <EOL> identifier = "<STR_LIT>" ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> new = rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> new . set_alias ( self . zone . id , "<STR_LIT>" % self . base_domain , False ) <EOL> rrs . commit ( ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> delete = rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> delete . set_alias ( self . zone . id , "<STR_LIT>" % self . base_domain , False ) <EOL> rrs . commit ( ) <EOL> def test_set_alias_backwards_compatability ( self ) : <EOL> base_record = dict ( name = "<STR_LIT>" % self . base_domain , <EOL> type = "<STR_LIT:A>" , <EOL> identifier = "<STR_LIT>" ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> new = rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> new . set_alias ( self . zone . id , "<STR_LIT>" % self . base_domain ) <EOL> rrs . commit ( ) <EOL> rrs = ResourceRecordSets ( self . conn , self . zone . id ) <EOL> delete = rrs . add_change ( action = "<STR_LIT>" , ** base_record ) <EOL> delete . set_alias ( self . zone . id , "<STR_LIT>" % self . base_domain ) <EOL> rrs . commit ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
