Lints.
This commit is contained in:
parent
1433f28846
commit
f37bad0e00
260 changed files with 6363 additions and 3766 deletions
|
|
@ -35,18 +35,21 @@ def test_create_cluster():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters(cluster_identifier)
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
|
||||
cluster['ClusterIdentifier'].should.equal(cluster_identifier)
|
||||
cluster['NodeType'].should.equal("dw.hs1.xlarge")
|
||||
cluster['MasterUsername'].should.equal("username")
|
||||
cluster['DBName'].should.equal("my_db")
|
||||
cluster['ClusterSecurityGroups'][0]['ClusterSecurityGroupName'].should.equal("Default")
|
||||
cluster['ClusterSecurityGroups'][0][
|
||||
'ClusterSecurityGroupName'].should.equal("Default")
|
||||
cluster['VpcSecurityGroups'].should.equal([])
|
||||
cluster['ClusterSubnetGroupName'].should.equal(None)
|
||||
cluster['AvailabilityZone'].should.equal("us-east-1d")
|
||||
cluster['PreferredMaintenanceWindow'].should.equal("Mon:03:00-Mon:11:00")
|
||||
cluster['ClusterParameterGroups'][0]['ParameterGroupName'].should.equal("default.redshift-1.0")
|
||||
cluster['ClusterParameterGroups'][0][
|
||||
'ParameterGroupName'].should.equal("default.redshift-1.0")
|
||||
cluster['AutomatedSnapshotRetentionPeriod'].should.equal(10)
|
||||
cluster['Port'].should.equal(1234)
|
||||
cluster['ClusterVersion'].should.equal("1.0")
|
||||
|
|
@ -69,7 +72,8 @@ def test_create_single_node_cluster():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters(cluster_identifier)
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
|
||||
cluster['ClusterIdentifier'].should.equal(cluster_identifier)
|
||||
cluster['NodeType'].should.equal("dw.hs1.xlarge")
|
||||
|
|
@ -91,13 +95,15 @@ def test_default_cluster_attibutes():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters(cluster_identifier)
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
|
||||
cluster['DBName'].should.equal("dev")
|
||||
cluster['ClusterSubnetGroupName'].should.equal(None)
|
||||
assert "us-east-" in cluster['AvailabilityZone']
|
||||
cluster['PreferredMaintenanceWindow'].should.equal("Mon:03:00-Mon:03:30")
|
||||
cluster['ClusterParameterGroups'][0]['ParameterGroupName'].should.equal("default.redshift-1.0")
|
||||
cluster['ClusterParameterGroups'][0][
|
||||
'ParameterGroupName'].should.equal("default.redshift-1.0")
|
||||
cluster['AutomatedSnapshotRetentionPeriod'].should.equal(1)
|
||||
cluster['Port'].should.equal(5439)
|
||||
cluster['ClusterVersion'].should.equal("1.0")
|
||||
|
|
@ -127,7 +133,8 @@ def test_create_cluster_in_subnet_group():
|
|||
)
|
||||
|
||||
cluster_response = redshift_conn.describe_clusters("my_cluster")
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
cluster['ClusterSubnetGroupName'].should.equal('my_subnet_group')
|
||||
|
||||
|
||||
|
|
@ -153,8 +160,10 @@ def test_create_cluster_with_security_group():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters(cluster_identifier)
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
group_names = [group['ClusterSecurityGroupName'] for group in cluster['ClusterSecurityGroups']]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
group_names = [group['ClusterSecurityGroupName']
|
||||
for group in cluster['ClusterSecurityGroups']]
|
||||
set(group_names).should.equal(set(["security_group1", "security_group2"]))
|
||||
|
||||
|
||||
|
|
@ -165,7 +174,8 @@ def test_create_cluster_with_vpc_security_groups():
|
|||
ec2_conn = boto.connect_ec2()
|
||||
redshift_conn = boto.connect_redshift()
|
||||
vpc = vpc_conn.create_vpc("10.0.0.0/16")
|
||||
security_group = ec2_conn.create_security_group("vpc_security_group", "a group", vpc_id=vpc.id)
|
||||
security_group = ec2_conn.create_security_group(
|
||||
"vpc_security_group", "a group", vpc_id=vpc.id)
|
||||
|
||||
redshift_conn.create_cluster(
|
||||
"my_cluster",
|
||||
|
|
@ -176,8 +186,10 @@ def test_create_cluster_with_vpc_security_groups():
|
|||
)
|
||||
|
||||
cluster_response = redshift_conn.describe_clusters("my_cluster")
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
group_ids = [group['VpcSecurityGroupId'] for group in cluster['VpcSecurityGroups']]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
group_ids = [group['VpcSecurityGroupId']
|
||||
for group in cluster['VpcSecurityGroups']]
|
||||
list(group_ids).should.equal([security_group.id])
|
||||
|
||||
|
||||
|
|
@ -199,14 +211,17 @@ def test_create_cluster_with_parameter_group():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters("my_cluster")
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster['ClusterParameterGroups'][0]['ParameterGroupName'].should.equal("my_parameter_group")
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
cluster['ClusterParameterGroups'][0][
|
||||
'ParameterGroupName'].should.equal("my_parameter_group")
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
def test_describe_non_existant_cluster():
|
||||
conn = boto.redshift.connect_to_region("us-east-1")
|
||||
conn.describe_clusters.when.called_with("not-a-cluster").should.throw(ClusterNotFound)
|
||||
conn.describe_clusters.when.called_with(
|
||||
"not-a-cluster").should.throw(ClusterNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -221,16 +236,19 @@ def test_delete_cluster():
|
|||
master_user_password="password",
|
||||
)
|
||||
|
||||
clusters = conn.describe_clusters()['DescribeClustersResponse']['DescribeClustersResult']['Clusters']
|
||||
clusters = conn.describe_clusters()['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters']
|
||||
list(clusters).should.have.length_of(1)
|
||||
|
||||
conn.delete_cluster(cluster_identifier)
|
||||
|
||||
clusters = conn.describe_clusters()['DescribeClustersResponse']['DescribeClustersResult']['Clusters']
|
||||
clusters = conn.describe_clusters()['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters']
|
||||
list(clusters).should.have.length_of(0)
|
||||
|
||||
# Delete invalid id
|
||||
conn.delete_cluster.when.called_with("not-a-cluster").should.throw(ClusterNotFound)
|
||||
conn.delete_cluster.when.called_with(
|
||||
"not-a-cluster").should.throw(ClusterNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -269,13 +287,16 @@ def test_modify_cluster():
|
|||
)
|
||||
|
||||
cluster_response = conn.describe_clusters("new_identifier")
|
||||
cluster = cluster_response['DescribeClustersResponse']['DescribeClustersResult']['Clusters'][0]
|
||||
cluster = cluster_response['DescribeClustersResponse'][
|
||||
'DescribeClustersResult']['Clusters'][0]
|
||||
|
||||
cluster['ClusterIdentifier'].should.equal("new_identifier")
|
||||
cluster['NodeType'].should.equal("dw.hs1.xlarge")
|
||||
cluster['ClusterSecurityGroups'][0]['ClusterSecurityGroupName'].should.equal("security_group")
|
||||
cluster['ClusterSecurityGroups'][0][
|
||||
'ClusterSecurityGroupName'].should.equal("security_group")
|
||||
cluster['PreferredMaintenanceWindow'].should.equal("Tue:03:00-Tue:11:00")
|
||||
cluster['ClusterParameterGroups'][0]['ParameterGroupName'].should.equal("my_parameter_group")
|
||||
cluster['ClusterParameterGroups'][0][
|
||||
'ParameterGroupName'].should.equal("my_parameter_group")
|
||||
cluster['AutomatedSnapshotRetentionPeriod'].should.equal(7)
|
||||
cluster['AllowVersionUpgrade'].should.equal(False)
|
||||
cluster['NumberOfNodes'].should.equal(2)
|
||||
|
|
@ -297,12 +318,15 @@ def test_create_cluster_subnet_group():
|
|||
subnet_ids=[subnet1.id, subnet2.id],
|
||||
)
|
||||
|
||||
subnets_response = redshift_conn.describe_cluster_subnet_groups("my_subnet")
|
||||
my_subnet = subnets_response['DescribeClusterSubnetGroupsResponse']['DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups'][0]
|
||||
subnets_response = redshift_conn.describe_cluster_subnet_groups(
|
||||
"my_subnet")
|
||||
my_subnet = subnets_response['DescribeClusterSubnetGroupsResponse'][
|
||||
'DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups'][0]
|
||||
|
||||
my_subnet['ClusterSubnetGroupName'].should.equal("my_subnet")
|
||||
my_subnet['Description'].should.equal("This is my subnet group")
|
||||
subnet_ids = [subnet['SubnetIdentifier'] for subnet in my_subnet['Subnets']]
|
||||
subnet_ids = [subnet['SubnetIdentifier']
|
||||
for subnet in my_subnet['Subnets']]
|
||||
set(subnet_ids).should.equal(set([subnet1.id, subnet2.id]))
|
||||
|
||||
|
||||
|
|
@ -320,7 +344,8 @@ def test_create_invalid_cluster_subnet_group():
|
|||
@mock_redshift_deprecated
|
||||
def test_describe_non_existant_subnet_group():
|
||||
conn = boto.redshift.connect_to_region("us-east-1")
|
||||
conn.describe_cluster_subnet_groups.when.called_with("not-a-subnet-group").should.throw(ClusterSubnetGroupNotFound)
|
||||
conn.describe_cluster_subnet_groups.when.called_with(
|
||||
"not-a-subnet-group").should.throw(ClusterSubnetGroupNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -338,17 +363,20 @@ def test_delete_cluster_subnet_group():
|
|||
)
|
||||
|
||||
subnets_response = redshift_conn.describe_cluster_subnet_groups()
|
||||
subnets = subnets_response['DescribeClusterSubnetGroupsResponse']['DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups']
|
||||
subnets = subnets_response['DescribeClusterSubnetGroupsResponse'][
|
||||
'DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups']
|
||||
subnets.should.have.length_of(1)
|
||||
|
||||
redshift_conn.delete_cluster_subnet_group("my_subnet")
|
||||
|
||||
subnets_response = redshift_conn.describe_cluster_subnet_groups()
|
||||
subnets = subnets_response['DescribeClusterSubnetGroupsResponse']['DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups']
|
||||
subnets = subnets_response['DescribeClusterSubnetGroupsResponse'][
|
||||
'DescribeClusterSubnetGroupsResult']['ClusterSubnetGroups']
|
||||
subnets.should.have.length_of(0)
|
||||
|
||||
# Delete invalid id
|
||||
redshift_conn.delete_cluster_subnet_group.when.called_with("not-a-subnet-group").should.throw(ClusterSubnetGroupNotFound)
|
||||
redshift_conn.delete_cluster_subnet_group.when.called_with(
|
||||
"not-a-subnet-group").should.throw(ClusterSubnetGroupNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -359,8 +387,10 @@ def test_create_cluster_security_group():
|
|||
"This is my security group",
|
||||
)
|
||||
|
||||
groups_response = conn.describe_cluster_security_groups("my_security_group")
|
||||
my_group = groups_response['DescribeClusterSecurityGroupsResponse']['DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups'][0]
|
||||
groups_response = conn.describe_cluster_security_groups(
|
||||
"my_security_group")
|
||||
my_group = groups_response['DescribeClusterSecurityGroupsResponse'][
|
||||
'DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups'][0]
|
||||
|
||||
my_group['ClusterSecurityGroupName'].should.equal("my_security_group")
|
||||
my_group['Description'].should.equal("This is my security group")
|
||||
|
|
@ -370,7 +400,8 @@ def test_create_cluster_security_group():
|
|||
@mock_redshift_deprecated
|
||||
def test_describe_non_existant_security_group():
|
||||
conn = boto.redshift.connect_to_region("us-east-1")
|
||||
conn.describe_cluster_security_groups.when.called_with("not-a-security-group").should.throw(ClusterSecurityGroupNotFound)
|
||||
conn.describe_cluster_security_groups.when.called_with(
|
||||
"not-a-security-group").should.throw(ClusterSecurityGroupNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -382,17 +413,20 @@ def test_delete_cluster_security_group():
|
|||
)
|
||||
|
||||
groups_response = conn.describe_cluster_security_groups()
|
||||
groups = groups_response['DescribeClusterSecurityGroupsResponse']['DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups']
|
||||
groups = groups_response['DescribeClusterSecurityGroupsResponse'][
|
||||
'DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups']
|
||||
groups.should.have.length_of(2) # The default group already exists
|
||||
|
||||
conn.delete_cluster_security_group("my_security_group")
|
||||
|
||||
groups_response = conn.describe_cluster_security_groups()
|
||||
groups = groups_response['DescribeClusterSecurityGroupsResponse']['DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups']
|
||||
groups = groups_response['DescribeClusterSecurityGroupsResponse'][
|
||||
'DescribeClusterSecurityGroupsResult']['ClusterSecurityGroups']
|
||||
groups.should.have.length_of(1)
|
||||
|
||||
# Delete invalid id
|
||||
conn.delete_cluster_security_group.when.called_with("not-a-security-group").should.throw(ClusterSecurityGroupNotFound)
|
||||
conn.delete_cluster_security_group.when.called_with(
|
||||
"not-a-security-group").should.throw(ClusterSecurityGroupNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -404,8 +438,10 @@ def test_create_cluster_parameter_group():
|
|||
"This is my parameter group",
|
||||
)
|
||||
|
||||
groups_response = conn.describe_cluster_parameter_groups("my_parameter_group")
|
||||
my_group = groups_response['DescribeClusterParameterGroupsResponse']['DescribeClusterParameterGroupsResult']['ParameterGroups'][0]
|
||||
groups_response = conn.describe_cluster_parameter_groups(
|
||||
"my_parameter_group")
|
||||
my_group = groups_response['DescribeClusterParameterGroupsResponse'][
|
||||
'DescribeClusterParameterGroupsResult']['ParameterGroups'][0]
|
||||
|
||||
my_group['ParameterGroupName'].should.equal("my_parameter_group")
|
||||
my_group['ParameterGroupFamily'].should.equal("redshift-1.0")
|
||||
|
|
@ -415,7 +451,8 @@ def test_create_cluster_parameter_group():
|
|||
@mock_redshift_deprecated
|
||||
def test_describe_non_existant_parameter_group():
|
||||
conn = boto.redshift.connect_to_region("us-east-1")
|
||||
conn.describe_cluster_parameter_groups.when.called_with("not-a-parameter-group").should.throw(ClusterParameterGroupNotFound)
|
||||
conn.describe_cluster_parameter_groups.when.called_with(
|
||||
"not-a-parameter-group").should.throw(ClusterParameterGroupNotFound)
|
||||
|
||||
|
||||
@mock_redshift_deprecated
|
||||
|
|
@ -428,14 +465,17 @@ def test_delete_cluster_parameter_group():
|
|||
)
|
||||
|
||||
groups_response = conn.describe_cluster_parameter_groups()
|
||||
groups = groups_response['DescribeClusterParameterGroupsResponse']['DescribeClusterParameterGroupsResult']['ParameterGroups']
|
||||
groups = groups_response['DescribeClusterParameterGroupsResponse'][
|
||||
'DescribeClusterParameterGroupsResult']['ParameterGroups']
|
||||
groups.should.have.length_of(2) # The default group already exists
|
||||
|
||||
conn.delete_cluster_parameter_group("my_parameter_group")
|
||||
|
||||
groups_response = conn.describe_cluster_parameter_groups()
|
||||
groups = groups_response['DescribeClusterParameterGroupsResponse']['DescribeClusterParameterGroupsResult']['ParameterGroups']
|
||||
groups = groups_response['DescribeClusterParameterGroupsResponse'][
|
||||
'DescribeClusterParameterGroupsResult']['ParameterGroups']
|
||||
groups.should.have.length_of(1)
|
||||
|
||||
# Delete invalid id
|
||||
conn.delete_cluster_parameter_group.when.called_with("not-a-parameter-group").should.throw(ClusterParameterGroupNotFound)
|
||||
conn.delete_cluster_parameter_group.when.called_with(
|
||||
"not-a-parameter-group").should.throw(ClusterParameterGroupNotFound)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue