Lints.
This commit is contained in:
parent
1433f28846
commit
f37bad0e00
260 changed files with 6363 additions and 3766 deletions
|
|
@ -23,15 +23,18 @@ def test_hosted_zone():
|
|||
zones = conn.get_all_hosted_zones()
|
||||
len(zones["ListHostedZonesResponse"]["HostedZones"]).should.equal(2)
|
||||
|
||||
id1 = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
id1 = firstzone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
zone = conn.get_hosted_zone(id1)
|
||||
zone["GetHostedZoneResponse"]["HostedZone"]["Name"].should.equal("testdns.aws.com.")
|
||||
zone["GetHostedZoneResponse"]["HostedZone"][
|
||||
"Name"].should.equal("testdns.aws.com.")
|
||||
|
||||
conn.delete_hosted_zone(id1)
|
||||
zones = conn.get_all_hosted_zones()
|
||||
len(zones["ListHostedZonesResponse"]["HostedZones"]).should.equal(1)
|
||||
|
||||
conn.get_hosted_zone.when.called_with("abcd").should.throw(boto.route53.exception.DNSServerError, "404 Not Found")
|
||||
conn.get_hosted_zone.when.called_with("abcd").should.throw(
|
||||
boto.route53.exception.DNSServerError, "404 Not Found")
|
||||
|
||||
|
||||
@mock_route53_deprecated
|
||||
|
|
@ -42,7 +45,8 @@ def test_rrset():
|
|||
boto.route53.exception.DNSServerError, "404 Not Found")
|
||||
|
||||
zone = conn.create_hosted_zone("testdns.aws.com")
|
||||
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
zoneid = zone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
changes = ResourceRecordSets(conn, zoneid)
|
||||
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A")
|
||||
|
|
@ -105,15 +109,18 @@ def test_rrset():
|
|||
rrsets = conn.get_all_rrsets(zoneid, type="A")
|
||||
rrsets.should.have.length_of(2)
|
||||
|
||||
rrsets = conn.get_all_rrsets(zoneid, name="foo.bar.testdns.aws.com", type="A")
|
||||
rrsets = conn.get_all_rrsets(
|
||||
zoneid, name="foo.bar.testdns.aws.com", type="A")
|
||||
rrsets.should.have.length_of(1)
|
||||
rrsets[0].resource_records[0].should.equal('1.2.3.4')
|
||||
|
||||
rrsets = conn.get_all_rrsets(zoneid, name="bar.foo.testdns.aws.com", type="A")
|
||||
rrsets = conn.get_all_rrsets(
|
||||
zoneid, name="bar.foo.testdns.aws.com", type="A")
|
||||
rrsets.should.have.length_of(1)
|
||||
rrsets[0].resource_records[0].should.equal('5.6.7.8')
|
||||
|
||||
rrsets = conn.get_all_rrsets(zoneid, name="foo.foo.testdns.aws.com", type="A")
|
||||
rrsets = conn.get_all_rrsets(
|
||||
zoneid, name="foo.foo.testdns.aws.com", type="A")
|
||||
rrsets.should.have.length_of(0)
|
||||
|
||||
|
||||
|
|
@ -121,7 +128,8 @@ def test_rrset():
|
|||
def test_rrset_with_multiple_values():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
zone = conn.create_hosted_zone("testdns.aws.com")
|
||||
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
zoneid = zone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
changes = ResourceRecordSets(conn, zoneid)
|
||||
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A")
|
||||
|
|
@ -138,11 +146,14 @@ def test_rrset_with_multiple_values():
|
|||
def test_alias_rrset():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
zone = conn.create_hosted_zone("testdns.aws.com")
|
||||
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
zoneid = zone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
changes = ResourceRecordSets(conn, zoneid)
|
||||
changes.add_change("CREATE", "foo.alias.testdns.aws.com", "A", alias_hosted_zone_id="Z3DG6IL3SJCGPX", alias_dns_name="foo.testdns.aws.com")
|
||||
changes.add_change("CREATE", "bar.alias.testdns.aws.com", "CNAME", alias_hosted_zone_id="Z3DG6IL3SJCGPX", alias_dns_name="bar.testdns.aws.com")
|
||||
changes.add_change("CREATE", "foo.alias.testdns.aws.com", "A",
|
||||
alias_hosted_zone_id="Z3DG6IL3SJCGPX", alias_dns_name="foo.testdns.aws.com")
|
||||
changes.add_change("CREATE", "bar.alias.testdns.aws.com", "CNAME",
|
||||
alias_hosted_zone_id="Z3DG6IL3SJCGPX", alias_dns_name="bar.testdns.aws.com")
|
||||
changes.commit()
|
||||
|
||||
rrsets = conn.get_all_rrsets(zoneid, type="A")
|
||||
|
|
@ -169,7 +180,8 @@ def test_create_health_check():
|
|||
)
|
||||
conn.create_health_check(check)
|
||||
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse']['HealthChecks']
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse'][
|
||||
'HealthChecks']
|
||||
list(checks).should.have.length_of(1)
|
||||
check = checks[0]
|
||||
config = check['HealthCheckConfig']
|
||||
|
|
@ -195,12 +207,14 @@ def test_delete_health_check():
|
|||
)
|
||||
conn.create_health_check(check)
|
||||
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse']['HealthChecks']
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse'][
|
||||
'HealthChecks']
|
||||
list(checks).should.have.length_of(1)
|
||||
health_check_id = checks[0]['Id']
|
||||
|
||||
conn.delete_health_check(health_check_id)
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse']['HealthChecks']
|
||||
checks = conn.get_list_health_checks()['ListHealthChecksResponse'][
|
||||
'HealthChecks']
|
||||
list(checks).should.have.length_of(0)
|
||||
|
||||
|
||||
|
|
@ -214,14 +228,17 @@ def test_use_health_check_in_resource_record_set():
|
|||
hc_type="HTTP",
|
||||
resource_path="/",
|
||||
)
|
||||
check = conn.create_health_check(check)['CreateHealthCheckResponse']['HealthCheck']
|
||||
check = conn.create_health_check(
|
||||
check)['CreateHealthCheckResponse']['HealthCheck']
|
||||
check_id = check['Id']
|
||||
|
||||
zone = conn.create_hosted_zone("testdns.aws.com")
|
||||
zone_id = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
zone_id = zone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
changes = ResourceRecordSets(conn, zone_id)
|
||||
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A", health_check=check_id)
|
||||
change = changes.add_change(
|
||||
"CREATE", "foo.bar.testdns.aws.com", "A", health_check=check_id)
|
||||
change.add_value("1.2.3.4")
|
||||
changes.commit()
|
||||
|
||||
|
|
@ -233,14 +250,18 @@ def test_use_health_check_in_resource_record_set():
|
|||
def test_hosted_zone_comment_preserved():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
|
||||
firstzone = conn.create_hosted_zone("testdns.aws.com.", comment="test comment")
|
||||
zone_id = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
firstzone = conn.create_hosted_zone(
|
||||
"testdns.aws.com.", comment="test comment")
|
||||
zone_id = firstzone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
hosted_zone = conn.get_hosted_zone(zone_id)
|
||||
hosted_zone["GetHostedZoneResponse"]["HostedZone"]["Config"]["Comment"].should.equal("test comment")
|
||||
hosted_zone["GetHostedZoneResponse"]["HostedZone"][
|
||||
"Config"]["Comment"].should.equal("test comment")
|
||||
|
||||
hosted_zones = conn.get_all_hosted_zones()
|
||||
hosted_zones["ListHostedZonesResponse"]["HostedZones"][0]["Config"]["Comment"].should.equal("test comment")
|
||||
hosted_zones["ListHostedZonesResponse"]["HostedZones"][
|
||||
0]["Config"]["Comment"].should.equal("test comment")
|
||||
|
||||
zone = conn.get_zone("testdns.aws.com.")
|
||||
zone.config["Comment"].should.equal("test comment")
|
||||
|
|
@ -253,16 +274,20 @@ def test_deleting_weighted_route():
|
|||
conn.create_hosted_zone("testdns.aws.com.")
|
||||
zone = conn.get_zone("testdns.aws.com.")
|
||||
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com", identifier=('success-test-foo', '50'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com", identifier=('success-test-bar', '50'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com",
|
||||
identifier=('success-test-foo', '50'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com",
|
||||
identifier=('success-test-bar', '50'))
|
||||
|
||||
cnames = zone.get_cname('cname.testdns.aws.com.', all=True)
|
||||
cnames.should.have.length_of(2)
|
||||
foo_cname = [cname for cname in cnames if cname.identifier == 'success-test-foo'][0]
|
||||
foo_cname = [cname for cname in cnames if cname.identifier ==
|
||||
'success-test-foo'][0]
|
||||
|
||||
zone.delete_record(foo_cname)
|
||||
cname = zone.get_cname('cname.testdns.aws.com.', all=True)
|
||||
# When get_cname only had one result, it returns just that result instead of a list.
|
||||
# When get_cname only had one result, it returns just that result instead
|
||||
# of a list.
|
||||
cname.identifier.should.equal('success-test-bar')
|
||||
|
||||
|
||||
|
|
@ -273,17 +298,21 @@ def test_deleting_latency_route():
|
|||
conn.create_hosted_zone("testdns.aws.com.")
|
||||
zone = conn.get_zone("testdns.aws.com.")
|
||||
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com", identifier=('success-test-foo', 'us-west-2'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com", identifier=('success-test-bar', 'us-west-1'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com",
|
||||
identifier=('success-test-foo', 'us-west-2'))
|
||||
zone.add_cname("cname.testdns.aws.com", "example.com",
|
||||
identifier=('success-test-bar', 'us-west-1'))
|
||||
|
||||
cnames = zone.get_cname('cname.testdns.aws.com.', all=True)
|
||||
cnames.should.have.length_of(2)
|
||||
foo_cname = [cname for cname in cnames if cname.identifier == 'success-test-foo'][0]
|
||||
foo_cname = [cname for cname in cnames if cname.identifier ==
|
||||
'success-test-foo'][0]
|
||||
foo_cname.region.should.equal('us-west-2')
|
||||
|
||||
zone.delete_record(foo_cname)
|
||||
cname = zone.get_cname('cname.testdns.aws.com.', all=True)
|
||||
# When get_cname only had one result, it returns just that result instead of a list.
|
||||
# When get_cname only had one result, it returns just that result instead
|
||||
# of a list.
|
||||
cname.identifier.should.equal('success-test-bar')
|
||||
cname.region.should.equal('us-west-1')
|
||||
|
||||
|
|
@ -292,15 +321,19 @@ def test_deleting_latency_route():
|
|||
def test_hosted_zone_private_zone_preserved():
|
||||
conn = boto.connect_route53('the_key', 'the_secret')
|
||||
|
||||
firstzone = conn.create_hosted_zone("testdns.aws.com.", private_zone=True, vpc_id='vpc-fake', vpc_region='us-east-1')
|
||||
zone_id = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
|
||||
firstzone = conn.create_hosted_zone(
|
||||
"testdns.aws.com.", private_zone=True, vpc_id='vpc-fake', vpc_region='us-east-1')
|
||||
zone_id = firstzone["CreateHostedZoneResponse"][
|
||||
"HostedZone"]["Id"].split("/")[-1]
|
||||
|
||||
hosted_zone = conn.get_hosted_zone(zone_id)
|
||||
# in (original) boto, these bools returned as strings.
|
||||
hosted_zone["GetHostedZoneResponse"]["HostedZone"]["Config"]["PrivateZone"].should.equal('True')
|
||||
hosted_zone["GetHostedZoneResponse"]["HostedZone"][
|
||||
"Config"]["PrivateZone"].should.equal('True')
|
||||
|
||||
hosted_zones = conn.get_all_hosted_zones()
|
||||
hosted_zones["ListHostedZonesResponse"]["HostedZones"][0]["Config"]["PrivateZone"].should.equal('True')
|
||||
hosted_zones["ListHostedZonesResponse"]["HostedZones"][
|
||||
0]["Config"]["PrivateZone"].should.equal('True')
|
||||
|
||||
zone = conn.get_zone("testdns.aws.com.")
|
||||
zone.config["PrivateZone"].should.equal('True')
|
||||
|
|
@ -331,6 +364,7 @@ def test_hosted_zone_private_zone_preserved_boto3():
|
|||
# zone = conn.list_hosted_zones_by_name(DNSName="testdns.aws.com.")
|
||||
# zone.config["PrivateZone"].should.equal(True)
|
||||
|
||||
|
||||
@mock_route53
|
||||
def test_list_or_change_tags_for_resource_request():
|
||||
conn = boto3.client('route53', region_name='us-east-1')
|
||||
|
|
@ -359,7 +393,8 @@ def test_list_or_change_tags_for_resource_request():
|
|||
)
|
||||
|
||||
# Check to make sure that the response has the 'ResourceTagSet' key
|
||||
response = conn.list_tags_for_resource(ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response = conn.list_tags_for_resource(
|
||||
ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response.should.contain('ResourceTagSet')
|
||||
|
||||
# Validate that each key was added
|
||||
|
|
@ -376,7 +411,8 @@ def test_list_or_change_tags_for_resource_request():
|
|||
)
|
||||
|
||||
# Check to make sure that the response has the 'ResourceTagSet' key
|
||||
response = conn.list_tags_for_resource(ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response = conn.list_tags_for_resource(
|
||||
ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response.should.contain('ResourceTagSet')
|
||||
response['ResourceTagSet']['Tags'].should_not.contain(tag1)
|
||||
response['ResourceTagSet']['Tags'].should.contain(tag2)
|
||||
|
|
@ -388,7 +424,8 @@ def test_list_or_change_tags_for_resource_request():
|
|||
RemoveTagKeys=[tag2['Key']]
|
||||
)
|
||||
|
||||
response = conn.list_tags_for_resource(ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response = conn.list_tags_for_resource(
|
||||
ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response['ResourceTagSet']['Tags'].should_not.contain(tag2)
|
||||
|
||||
# Re-add the tags
|
||||
|
|
@ -405,5 +442,6 @@ def test_list_or_change_tags_for_resource_request():
|
|||
RemoveTagKeys=[tag1['Key'], tag2['Key']]
|
||||
)
|
||||
|
||||
response = conn.list_tags_for_resource(ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response = conn.list_tags_for_resource(
|
||||
ResourceType='healthcheck', ResourceId=healthcheck_id)
|
||||
response['ResourceTagSet']['Tags'].should.be.empty
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue