How to use the moto.mock_rds2 function in moto

To help you get started, we’ve selected a few moto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_list_tags_snapshot():
    conn = boto3.client("rds", region_name="us-west-2")
    result = conn.list_tags_for_resource(
        ResourceName="arn:aws:rds:us-west-2:1234567890:snapshot:foo"
    )
    result["TagList"].should.equal([])
    conn.create_db_instance(
        DBInstanceIdentifier="db-primary-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBName="staging-postgres",
        DBInstanceClass="db.m1.small",
        MasterUsername="root",
        MasterUserPassword="hunter2",
        Port=1234,
        DBSecurityGroups=["my_sg"],
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_database_with_option_group():
    conn = boto3.client("rds", region_name="us-west-2")
    conn.create_option_group(
        OptionGroupName="my-og",
        EngineName="mysql",
        MajorEngineVersion="5.6",
        OptionGroupDescription="test option group",
    )
    database = conn.create_db_instance(
        DBInstanceIdentifier="db-master-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBName="staging-postgres",
        DBInstanceClass="db.m1.small",
        OptionGroupName="my-og",
    )
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_delete_option_group():
    conn = boto3.client("rds", region_name="us-west-2")
    conn.create_option_group(
        OptionGroupName="test",
        EngineName="mysql",
        MajorEngineVersion="5.6",
        OptionGroupDescription="test option group",
    )
    option_groups = conn.describe_option_groups(OptionGroupName="test")
    option_groups["OptionGroupsList"][0]["OptionGroupName"].should.equal("test")
    conn.delete_option_group(OptionGroupName="test")
    conn.describe_option_groups.when.called_with(OptionGroupName="test").should.throw(
        ClientError
    )
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_database():
    conn = boto3.client("rds", region_name="us-west-2")
    database = conn.create_db_instance(
        DBInstanceIdentifier="db-master-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBName="staging-postgres",
        DBInstanceClass="db.m1.small",
        LicenseModel="license-included",
        MasterUsername="root",
        MasterUserPassword="hunter2",
        Port=1234,
        DBSecurityGroups=["my_sg"],
        VpcSecurityGroupIds=["sg-123456"],
    )
    db_instance = database["DBInstance"]
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_database_non_existing_option_group():
    conn = boto3.client("rds", region_name="us-west-2")
    database = conn.create_db_instance.when.called_with(
        DBInstanceIdentifier="db-master-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBName="staging-postgres",
        DBInstanceClass="db.m1.small",
        OptionGroupName="non-existing",
    ).should.throw(ClientError)
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_delete_db_snapshot():
    conn = boto3.client("rds", region_name="us-west-2")
    conn.create_db_instance(
        DBInstanceIdentifier="db-primary-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBName="staging-postgres",
        DBInstanceClass="db.m1.small",
        MasterUsername="root",
        MasterUserPassword="hunter2",
        Port=1234,
        DBSecurityGroups=["my_sg"],
    )
    conn.create_db_snapshot(
        DBInstanceIdentifier="db-primary-1", DBSnapshotIdentifier="snapshot-1"
    )
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_db_parameter_group_duplicate():
    conn = boto3.client("rds", region_name="us-west-2")
    conn.create_db_parameter_group(
        DBParameterGroupName="test",
        DBParameterGroupFamily="mysql5.6",
        Description="test parameter group",
    )
    conn.create_db_parameter_group.when.called_with(
        DBParameterGroupName="test",
        DBParameterGroupFamily="mysql5.6",
        Description="test parameter group",
    ).should.throw(ClientError)
github diodonfrost / terraform-aws-lambda-scheduler-stop-start / tests / unit / test_rds_scheduler.py View on Github external
@mock_rds2
def test_list_rds(aws_region, tag_key, tag_value, result_count):
    """Verify list rds instance function."""
    launch_rds_instance(aws_region, "tostop", "true")
    rds_scheduler = RdsScheduler(aws_region)
    taglist = rds_scheduler.list_instances(tag_key, tag_value)
    assert len(list(taglist)) == result_count
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_option_group_bad_engine_major_version():
    conn = boto3.client("rds", region_name="us-west-2")
    conn.create_option_group.when.called_with(
        OptionGroupName="test",
        EngineName="mysql",
        MajorEngineVersion="6.6.6",
        OptionGroupDescription="test invalid engine version",
    ).should.throw(ClientError)
github spulec / moto / tests / test_rds2 / test_rds2.py View on Github external
@mock_rds2
def test_create_database_replica():
    conn = boto3.client("rds", region_name="us-west-2")

    database = conn.create_db_instance(
        DBInstanceIdentifier="db-master-1",
        AllocatedStorage=10,
        Engine="postgres",
        DBInstanceClass="db.m1.small",
        MasterUsername="root",
        MasterUserPassword="hunter2",
        Port=1234,
        DBSecurityGroups=["my_sg"],
    )

    replica = conn.create_db_instance_read_replica(
        DBInstanceIdentifier="db-replica-1",