diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/rds/test_connection.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/unit/rds/test_connection.py b/tests/unit/rds/test_connection.py index d6813321..b8d012d1 100644 --- a/tests/unit/rds/test_connection.py +++ b/tests/unit/rds/test_connection.py @@ -24,7 +24,9 @@ from tests.unit import unittest from tests.unit import AWSMockServiceTestCase +from boto.ec2.securitygroup import SecurityGroup from boto.rds import RDSConnection +from boto.rds.vpcsecuritygroupmembership import VPCSecurityGroupMembership from boto.rds.parametergroup import ParameterGroup @@ -73,6 +75,12 @@ class TestRDSConnection(AWSMockServiceTestCase): <DBSecurityGroupName>default</DBSecurityGroupName> </DBSecurityGroup> </DBSecurityGroups> + <VpcSecurityGroups> + <VpcSecurityGroupMembership> + <VpcSecurityGroupId>sg-1</VpcSecurityGroupId> + <Status>active</Status> + </VpcSecurityGroupMembership> + </VpcSecurityGroups> <DBName>mydb2</DBName> <AutoMinorVersionUpgrade>true</AutoMinorVersionUpgrade> <InstanceCreateTime>2012-10-03T22:01:51.047Z</InstanceCreateTime> @@ -137,6 +145,8 @@ class TestRDSConnection(AWSMockServiceTestCase): self.assertEqual(db.status_infos[0].normal, True) self.assertEqual(db.status_infos[0].status, 'replicating') self.assertEqual(db.status_infos[0].status_type, 'read replication') + self.assertEqual(db.vpc_security_groups[0].status, 'active') + self.assertEqual(db.vpc_security_groups[0].vpc_group, 'sg-1') class TestRDSCCreateDBInstance(AWSMockServiceTestCase): @@ -387,6 +397,74 @@ class TestRDSConnectionRestoreDBInstanceFromPointInTime(AWSMockServiceTestCase): 'DBSubnetGroupName': 'dbsubnetgroup', }, ignore_params_values=['Version']) + def test_create_db_instance_vpc_sg_str(self): + self.set_http_response(status_code=200) + vpc_security_groups = [ + VPCSecurityGroupMembership(self.service_connection, 'active', 'sg-1'), + VPCSecurityGroupMembership(self.service_connection, None, 'sg-2')] + + db = self.service_connection.create_dbinstance( + 'SimCoProd01', + 10, + 'db.m1.large', + 'master', + 'Password01', + param_group='default.mysql5.1', + db_subnet_group_name='dbSubnetgroup01', + vpc_security_groups=vpc_security_groups) + + self.assert_request_parameters({ + 'Action': 'CreateDBInstance', + 'AllocatedStorage': 10, + 'AutoMinorVersionUpgrade': 'true', + 'DBInstanceClass': 'db.m1.large', + 'DBInstanceIdentifier': 'SimCoProd01', + 'DBParameterGroupName': 'default.mysql5.1', + 'DBSubnetGroupName': 'dbSubnetgroup01', + 'Engine': 'MySQL5.1', + 'MasterUsername': 'master', + 'MasterUserPassword': 'Password01', + 'Port': 3306, + 'VpcSecurityGroupIds.member.1': 'sg-1', + 'VpcSecurityGroupIds.member.2': 'sg-2' + }, ignore_params_values=['Version']) + + def test_create_db_instance_vpc_sg_obj(self): + self.set_http_response(status_code=200) + + sg1 = SecurityGroup(name='sg-1') + sg2 = SecurityGroup(name='sg-2') + + vpc_security_groups = [ + VPCSecurityGroupMembership(self.service_connection, 'active', sg1.name), + VPCSecurityGroupMembership(self.service_connection, None, sg2.name)] + + db = self.service_connection.create_dbinstance( + 'SimCoProd01', + 10, + 'db.m1.large', + 'master', + 'Password01', + param_group='default.mysql5.1', + db_subnet_group_name='dbSubnetgroup01', + vpc_security_groups=vpc_security_groups) + + self.assert_request_parameters({ + 'Action': 'CreateDBInstance', + 'AllocatedStorage': 10, + 'AutoMinorVersionUpgrade': 'true', + 'DBInstanceClass': 'db.m1.large', + 'DBInstanceIdentifier': 'SimCoProd01', + 'DBParameterGroupName': 'default.mysql5.1', + 'DBSubnetGroupName': 'dbSubnetgroup01', + 'Engine': 'MySQL5.1', + 'MasterUsername': 'master', + 'MasterUserPassword': 'Password01', + 'Port': 3306, + 'VpcSecurityGroupIds.member.1': 'sg-1', + 'VpcSecurityGroupIds.member.2': 'sg-2' + }, ignore_params_values=['Version']) + class TestRDSOptionGroups(AWSMockServiceTestCase): connection_class = RDSConnection |