url = safe_url % (db_pass[0][1]) os.environ["OZAUR_DB_URL"] = url vpc = boto.vpc.connect_to_region("us-west-2") print "Allowing us to talk to DB" group_id = db_security_groups[0] args = { "group_id": db_security_groups[0], "ip_protocol": "tcp", "cidr_ip": requests.get("http://ip.42.pl/raw").text + "/32", "to_port": instance["Endpoint"]["Port"], "from_port": instance["Endpoint"]["Port"], } response = vpc.authorize_security_group(**args) assert response, "Can't authorize RDS to talk with me" import database print "Deleting DB schema" database.delete_schema() print "Creating DB schema" database.create_schema() print "Removing us from being able to talk to DB" response = vpc.revoke_security_group(**args) assert response, "Can't revoke RDS to talk with me"
def tearDown(self): delete_schema()
assert len(db_pass) == 1, "Expect one db password" url = safe_url % (db_pass[0][1]) os.environ["OZAUR_DB_URL"] = url vpc = boto.vpc.connect_to_region("us-west-2") print "Allowing us to talk to DB" group_id = db_security_groups[0] args = { "group_id": db_security_groups[0], "ip_protocol": "tcp", "cidr_ip": requests.get("http://ip.42.pl/raw").text + "/32", "to_port": instance["Endpoint"]["Port"], "from_port": instance["Endpoint"]["Port"], } response = vpc.authorize_security_group(**args) assert response, "Can't authorize RDS to talk with me" import database print "Deleting DB schema" database.delete_schema() print "Creating DB schema" database.create_schema() print "Removing us from being able to talk to DB" response = vpc.revoke_security_group(**args) assert response, "Can't revoke RDS to talk with me"