Deprecate RDS2 (#4920)
This commit is contained in:
parent
778c8d768e
commit
9dccebc184
@ -16,8 +16,8 @@ rds
|
|||||||
|
|
||||||
.. sourcecode:: python
|
.. sourcecode:: python
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_rds2_behaviour:
|
def test_rds_behaviour:
|
||||||
boto3.client("rds")
|
boto3.client("rds")
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -4,7 +4,12 @@ from contextlib import ContextDecorator
|
|||||||
|
|
||||||
|
|
||||||
def lazy_load(
|
def lazy_load(
|
||||||
module_name, element, boto3_name=None, backend=None, warn_repurpose=False
|
module_name,
|
||||||
|
element,
|
||||||
|
boto3_name=None,
|
||||||
|
backend=None,
|
||||||
|
warn_repurpose=False,
|
||||||
|
use_instead=None,
|
||||||
):
|
):
|
||||||
def f(*args, **kwargs):
|
def f(*args, **kwargs):
|
||||||
if warn_repurpose:
|
if warn_repurpose:
|
||||||
@ -14,6 +19,14 @@ def lazy_load(
|
|||||||
f"Module {element} has been deprecated, and will be repurposed in a later release. "
|
f"Module {element} has been deprecated, and will be repurposed in a later release. "
|
||||||
"Please see https://github.com/spulec/moto/issues/4526 for more information."
|
"Please see https://github.com/spulec/moto/issues/4526 for more information."
|
||||||
)
|
)
|
||||||
|
if use_instead:
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
used, recommended = use_instead
|
||||||
|
warnings.warn(
|
||||||
|
f"Module {used} has been deprecated, and will be removed in a later release. Please use {recommended} instead. "
|
||||||
|
"See https://github.com/spulec/moto/issues/4526 for more information."
|
||||||
|
)
|
||||||
module = importlib.import_module(module_name, "moto")
|
module = importlib.import_module(module_name, "moto")
|
||||||
return getattr(module, element)(*args, **kwargs)
|
return getattr(module, element)(*args, **kwargs)
|
||||||
|
|
||||||
@ -110,8 +123,8 @@ mock_organizations = lazy_load(".organizations", "mock_organizations")
|
|||||||
mock_pinpoint = lazy_load(".pinpoint", "mock_pinpoint")
|
mock_pinpoint = lazy_load(".pinpoint", "mock_pinpoint")
|
||||||
mock_polly = lazy_load(".polly", "mock_polly")
|
mock_polly = lazy_load(".polly", "mock_polly")
|
||||||
mock_ram = lazy_load(".ram", "mock_ram")
|
mock_ram = lazy_load(".ram", "mock_ram")
|
||||||
mock_rds = lazy_load(".rds", "mock_rds", warn_repurpose=True)
|
mock_rds = lazy_load(".rds", "mock_rds")
|
||||||
mock_rds2 = lazy_load(".rds2", "mock_rds2", boto3_name="rds")
|
mock_rds2 = lazy_load(".rds", "mock_rds", use_instead=("mock_rds2", "mock_rds"))
|
||||||
mock_redshift = lazy_load(".redshift", "mock_redshift")
|
mock_redshift = lazy_load(".redshift", "mock_redshift")
|
||||||
mock_redshiftdata = lazy_load(
|
mock_redshiftdata = lazy_load(
|
||||||
".redshiftdata", "mock_redshiftdata", boto3_name="redshift-data"
|
".redshiftdata", "mock_redshiftdata", boto3_name="redshift-data"
|
||||||
|
@ -33,7 +33,7 @@ from moto.iam import models # noqa # pylint: disable=all
|
|||||||
from moto.kinesis import models # noqa # pylint: disable=all
|
from moto.kinesis import models # noqa # pylint: disable=all
|
||||||
from moto.kms import models # noqa # pylint: disable=all
|
from moto.kms import models # noqa # pylint: disable=all
|
||||||
from moto.rds import models # noqa # pylint: disable=all
|
from moto.rds import models # noqa # pylint: disable=all
|
||||||
from moto.rds2 import models # noqa # pylint: disable=all
|
from moto.rds import models # noqa # pylint: disable=all
|
||||||
from moto.redshift import models # noqa # pylint: disable=all
|
from moto.redshift import models # noqa # pylint: disable=all
|
||||||
from moto.route53 import models # noqa # pylint: disable=all
|
from moto.route53 import models # noqa # pylint: disable=all
|
||||||
from moto.s3 import models # noqa # pylint: disable=all
|
from moto.s3 import models # noqa # pylint: disable=all
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from .models import rds_backends
|
from .models import rds_backends
|
||||||
from ..core.models import base_decorator
|
from ..core.models import base_decorator
|
||||||
|
|
||||||
|
rds_backend = rds_backends["us-west-1"]
|
||||||
mock_rds = base_decorator(rds_backends)
|
mock_rds = base_decorator(rds_backends)
|
||||||
|
@ -1,22 +1,37 @@
|
|||||||
import json
|
from jinja2 import Template
|
||||||
from werkzeug.exceptions import BadRequest
|
from werkzeug.exceptions import BadRequest
|
||||||
|
|
||||||
|
|
||||||
class RDSClientError(BadRequest):
|
class RDSClientError(BadRequest):
|
||||||
def __init__(self, code, message):
|
def __init__(self, code, message):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.description = json.dumps(
|
template = Template(
|
||||||
{
|
"""
|
||||||
"Error": {"Code": code, "Message": message, "Type": "Sender"},
|
<RDSClientError>
|
||||||
"RequestId": "6876f774-7273-11e4-85dc-39e55ca848d1",
|
<Error>
|
||||||
}
|
<Code>{{ code }}</Code>
|
||||||
|
<Message>{{ message }}</Message>
|
||||||
|
<Type>Sender</Type>
|
||||||
|
</Error>
|
||||||
|
<RequestId>6876f774-7273-11e4-85dc-39e55ca848d1</RequestId>
|
||||||
|
</RDSClientError>"""
|
||||||
)
|
)
|
||||||
|
self.description = template.render(code=code, message=message)
|
||||||
|
|
||||||
|
|
||||||
class DBInstanceNotFoundError(RDSClientError):
|
class DBInstanceNotFoundError(RDSClientError):
|
||||||
def __init__(self, database_identifier):
|
def __init__(self, database_identifier):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
"DBInstanceNotFound", "Database {0} not found.".format(database_identifier)
|
"DBInstanceNotFound",
|
||||||
|
"DBInstance {0} not found.".format(database_identifier),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DBSnapshotNotFoundError(RDSClientError):
|
||||||
|
def __init__(self, snapshot_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"DBSnapshotNotFound",
|
||||||
|
"DBSnapshot {} not found.".format(snapshot_identifier),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -36,11 +51,145 @@ class DBSubnetGroupNotFoundError(RDSClientError):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class UnformattedGetAttTemplateException(Exception):
|
class DBParameterGroupNotFoundError(RDSClientError):
|
||||||
"""Duplicated from CloudFormation to prevent circular deps."""
|
def __init__(self, db_parameter_group_name):
|
||||||
|
super().__init__(
|
||||||
|
"DBParameterGroupNotFound",
|
||||||
|
"DB Parameter Group {0} not found.".format(db_parameter_group_name),
|
||||||
|
)
|
||||||
|
|
||||||
description = (
|
|
||||||
"Template error: resource {0} does not support attribute type {1} in Fn::GetAtt"
|
|
||||||
)
|
|
||||||
|
|
||||||
status_code = 400
|
class OptionGroupNotFoundFaultError(RDSClientError):
|
||||||
|
def __init__(self, option_group_name):
|
||||||
|
super().__init__(
|
||||||
|
"OptionGroupNotFoundFault",
|
||||||
|
"Specified OptionGroupName: {0} not found.".format(option_group_name),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidDBClusterStateFaultError(RDSClientError):
|
||||||
|
def __init__(self, database_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"InvalidDBClusterStateFault",
|
||||||
|
"Invalid DB type, when trying to perform StopDBInstance on {0}e. See AWS RDS documentation on rds.stop_db_instance".format(
|
||||||
|
database_identifier
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidDBInstanceStateError(RDSClientError):
|
||||||
|
def __init__(self, database_identifier, istate):
|
||||||
|
estate = (
|
||||||
|
"in available state"
|
||||||
|
if istate == "stop"
|
||||||
|
else "stopped, it cannot be started"
|
||||||
|
)
|
||||||
|
super().__init__(
|
||||||
|
"InvalidDBInstanceState",
|
||||||
|
"Instance {} is not {}.".format(database_identifier, estate),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SnapshotQuotaExceededError(RDSClientError):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(
|
||||||
|
"SnapshotQuotaExceeded",
|
||||||
|
"The request cannot be processed because it would exceed the maximum number of snapshots.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DBSnapshotAlreadyExistsError(RDSClientError):
|
||||||
|
def __init__(self, database_snapshot_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"DBSnapshotAlreadyExists",
|
||||||
|
"Cannot create the snapshot because a snapshot with the identifier {} already exists.".format(
|
||||||
|
database_snapshot_identifier
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidParameterValue(RDSClientError):
|
||||||
|
def __init__(self, message):
|
||||||
|
super().__init__("InvalidParameterValue", message)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidParameterCombination(RDSClientError):
|
||||||
|
def __init__(self, message):
|
||||||
|
super().__init__("InvalidParameterCombination", message)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidDBClusterStateFault(RDSClientError):
|
||||||
|
def __init__(self, message):
|
||||||
|
super().__init__("InvalidDBClusterStateFault", message)
|
||||||
|
|
||||||
|
|
||||||
|
class DBClusterNotFoundError(RDSClientError):
|
||||||
|
def __init__(self, cluster_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"DBClusterNotFoundFault",
|
||||||
|
"DBCluster {} not found.".format(cluster_identifier),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DBClusterSnapshotNotFoundError(RDSClientError):
|
||||||
|
def __init__(self, snapshot_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"DBClusterSnapshotNotFoundFault",
|
||||||
|
"DBClusterSnapshot {} not found.".format(snapshot_identifier),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DBClusterSnapshotAlreadyExistsError(RDSClientError):
|
||||||
|
def __init__(self, database_snapshot_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"DBClusterSnapshotAlreadyExistsFault",
|
||||||
|
"Cannot create the snapshot because a snapshot with the identifier {} already exists.".format(
|
||||||
|
database_snapshot_identifier
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ExportTaskAlreadyExistsError(RDSClientError):
|
||||||
|
def __init__(self, export_task_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"ExportTaskAlreadyExistsFault",
|
||||||
|
"Cannot start export task because a task with the identifier {} already exists.".format(
|
||||||
|
export_task_identifier
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ExportTaskNotFoundError(RDSClientError):
|
||||||
|
def __init__(self, export_task_identifier):
|
||||||
|
super().__init__(
|
||||||
|
"ExportTaskNotFoundFault",
|
||||||
|
"Cannot cancel export task because a task with the identifier {} is not exist.".format(
|
||||||
|
export_task_identifier
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidExportSourceStateError(RDSClientError):
|
||||||
|
def __init__(self, status):
|
||||||
|
super().__init__(
|
||||||
|
"InvalidExportSourceStateFault",
|
||||||
|
"Export source should be 'available' but current status is {}.".format(
|
||||||
|
status
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionAlreadyExistError(RDSClientError):
|
||||||
|
def __init__(self, subscription_name):
|
||||||
|
super().__init__(
|
||||||
|
"SubscriptionAlreadyExistFault",
|
||||||
|
"Subscription {} already exists.".format(subscription_name),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionNotFoundError(RDSClientError):
|
||||||
|
def __init__(self, subscription_name):
|
||||||
|
super().__init__(
|
||||||
|
"SubscriptionNotFoundFault",
|
||||||
|
"Subscription {} not found.".format(subscription_name),
|
||||||
|
)
|
||||||
|
2119
moto/rds/models.py
2119
moto/rds/models.py
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
from .responses import RDSResponse
|
from .responses import RDSResponse
|
||||||
|
|
||||||
url_bases = [r"https?://rds(\..+)?.amazonaws.com"]
|
url_bases = [r"https?://rds\.(.+)\.amazonaws\.com", r"https?://rds\.amazonaws\.com"]
|
||||||
|
|
||||||
url_paths = {"{0}/$": RDSResponse.dispatch}
|
url_paths = {"{0}/$": RDSResponse.dispatch}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
from .models import rds2_backends
|
|
||||||
from ..core.models import base_decorator
|
|
||||||
|
|
||||||
rds2_backend = rds2_backends["us-west-1"]
|
|
||||||
mock_rds2 = base_decorator(rds2_backends)
|
|
@ -1,195 +0,0 @@
|
|||||||
from jinja2 import Template
|
|
||||||
from werkzeug.exceptions import BadRequest
|
|
||||||
|
|
||||||
|
|
||||||
class RDSClientError(BadRequest):
|
|
||||||
def __init__(self, code, message):
|
|
||||||
super().__init__()
|
|
||||||
template = Template(
|
|
||||||
"""
|
|
||||||
<RDSClientError>
|
|
||||||
<Error>
|
|
||||||
<Code>{{ code }}</Code>
|
|
||||||
<Message>{{ message }}</Message>
|
|
||||||
<Type>Sender</Type>
|
|
||||||
</Error>
|
|
||||||
<RequestId>6876f774-7273-11e4-85dc-39e55ca848d1</RequestId>
|
|
||||||
</RDSClientError>"""
|
|
||||||
)
|
|
||||||
self.description = template.render(code=code, message=message)
|
|
||||||
|
|
||||||
|
|
||||||
class DBInstanceNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, database_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBInstanceNotFound",
|
|
||||||
"DBInstance {0} not found.".format(database_identifier),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBSnapshotNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, snapshot_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBSnapshotNotFound",
|
|
||||||
"DBSnapshot {} not found.".format(snapshot_identifier),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBSecurityGroupNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, security_group_name):
|
|
||||||
super().__init__(
|
|
||||||
"DBSecurityGroupNotFound",
|
|
||||||
"Security Group {0} not found.".format(security_group_name),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBSubnetGroupNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, subnet_group_name):
|
|
||||||
super().__init__(
|
|
||||||
"DBSubnetGroupNotFound",
|
|
||||||
"Subnet Group {0} not found.".format(subnet_group_name),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBParameterGroupNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, db_parameter_group_name):
|
|
||||||
super().__init__(
|
|
||||||
"DBParameterGroupNotFound",
|
|
||||||
"DB Parameter Group {0} not found.".format(db_parameter_group_name),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OptionGroupNotFoundFaultError(RDSClientError):
|
|
||||||
def __init__(self, option_group_name):
|
|
||||||
super().__init__(
|
|
||||||
"OptionGroupNotFoundFault",
|
|
||||||
"Specified OptionGroupName: {0} not found.".format(option_group_name),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidDBClusterStateFaultError(RDSClientError):
|
|
||||||
def __init__(self, database_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"InvalidDBClusterStateFault",
|
|
||||||
"Invalid DB type, when trying to perform StopDBInstance on {0}e. See AWS RDS documentation on rds.stop_db_instance".format(
|
|
||||||
database_identifier
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidDBInstanceStateError(RDSClientError):
|
|
||||||
def __init__(self, database_identifier, istate):
|
|
||||||
estate = (
|
|
||||||
"in available state"
|
|
||||||
if istate == "stop"
|
|
||||||
else "stopped, it cannot be started"
|
|
||||||
)
|
|
||||||
super().__init__(
|
|
||||||
"InvalidDBInstanceState",
|
|
||||||
"Instance {} is not {}.".format(database_identifier, estate),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SnapshotQuotaExceededError(RDSClientError):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(
|
|
||||||
"SnapshotQuotaExceeded",
|
|
||||||
"The request cannot be processed because it would exceed the maximum number of snapshots.",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBSnapshotAlreadyExistsError(RDSClientError):
|
|
||||||
def __init__(self, database_snapshot_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBSnapshotAlreadyExists",
|
|
||||||
"Cannot create the snapshot because a snapshot with the identifier {} already exists.".format(
|
|
||||||
database_snapshot_identifier
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidParameterValue(RDSClientError):
|
|
||||||
def __init__(self, message):
|
|
||||||
super().__init__("InvalidParameterValue", message)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidParameterCombination(RDSClientError):
|
|
||||||
def __init__(self, message):
|
|
||||||
super().__init__("InvalidParameterCombination", message)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidDBClusterStateFault(RDSClientError):
|
|
||||||
def __init__(self, message):
|
|
||||||
super().__init__("InvalidDBClusterStateFault", message)
|
|
||||||
|
|
||||||
|
|
||||||
class DBClusterNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, cluster_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBClusterNotFoundFault",
|
|
||||||
"DBCluster {} not found.".format(cluster_identifier),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBClusterSnapshotNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, snapshot_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBClusterSnapshotNotFoundFault",
|
|
||||||
"DBClusterSnapshot {} not found.".format(snapshot_identifier),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DBClusterSnapshotAlreadyExistsError(RDSClientError):
|
|
||||||
def __init__(self, database_snapshot_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"DBClusterSnapshotAlreadyExistsFault",
|
|
||||||
"Cannot create the snapshot because a snapshot with the identifier {} already exists.".format(
|
|
||||||
database_snapshot_identifier
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ExportTaskAlreadyExistsError(RDSClientError):
|
|
||||||
def __init__(self, export_task_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"ExportTaskAlreadyExistsFault",
|
|
||||||
"Cannot start export task because a task with the identifier {} already exists.".format(
|
|
||||||
export_task_identifier
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ExportTaskNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, export_task_identifier):
|
|
||||||
super().__init__(
|
|
||||||
"ExportTaskNotFoundFault",
|
|
||||||
"Cannot cancel export task because a task with the identifier {} is not exist.".format(
|
|
||||||
export_task_identifier
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidExportSourceStateError(RDSClientError):
|
|
||||||
def __init__(self, status):
|
|
||||||
super().__init__(
|
|
||||||
"InvalidExportSourceStateFault",
|
|
||||||
"Export source should be 'available' but current status is {}.".format(
|
|
||||||
status
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SubscriptionAlreadyExistError(RDSClientError):
|
|
||||||
def __init__(self, subscription_name):
|
|
||||||
super().__init__(
|
|
||||||
"SubscriptionAlreadyExistFault",
|
|
||||||
"Subscription {} already exists.".format(subscription_name),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SubscriptionNotFoundError(RDSClientError):
|
|
||||||
def __init__(self, subscription_name):
|
|
||||||
super().__init__(
|
|
||||||
"SubscriptionNotFoundFault",
|
|
||||||
"Subscription {} not found.".format(subscription_name),
|
|
||||||
)
|
|
2291
moto/rds2/models.py
2291
moto/rds2/models.py
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
|||||||
from .responses import RDS2Response
|
|
||||||
|
|
||||||
url_bases = [r"https?://rds\.(.+)\.amazonaws\.com", r"https?://rds\.amazonaws\.com"]
|
|
||||||
|
|
||||||
url_paths = {"{0}/$": RDS2Response.dispatch}
|
|
@ -11,7 +11,7 @@ from moto.elb import elb_backends
|
|||||||
from moto.elbv2 import elbv2_backends
|
from moto.elbv2 import elbv2_backends
|
||||||
from moto.kinesis import kinesis_backends
|
from moto.kinesis import kinesis_backends
|
||||||
from moto.kms import kms_backends
|
from moto.kms import kms_backends
|
||||||
from moto.rds2 import rds2_backends
|
from moto.rds import rds_backends
|
||||||
from moto.glacier import glacier_backends
|
from moto.glacier import glacier_backends
|
||||||
from moto.redshift import redshift_backends
|
from moto.redshift import redshift_backends
|
||||||
from moto.emr import emr_backends
|
from moto.emr import emr_backends
|
||||||
@ -83,9 +83,9 @@ class ResourceGroupsTaggingAPIBackend(BaseBackend):
|
|||||||
@property
|
@property
|
||||||
def rds_backend(self):
|
def rds_backend(self):
|
||||||
"""
|
"""
|
||||||
:rtype: moto.rds2.models.RDS2Backend
|
:rtype: moto.rds.models.RDSBackend
|
||||||
"""
|
"""
|
||||||
return rds2_backends[self.region_name]
|
return rds_backends[self.region_name]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def glacier_backend(self):
|
def glacier_backend(self):
|
||||||
|
@ -7,7 +7,7 @@ import boto3
|
|||||||
|
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
alternative_service_names = {"lambda": "awslambda", "dynamodb": "dynamodb2", "rds": "rds2"}
|
alternative_service_names = {"lambda": "awslambda", "dynamodb": "dynamodb2"}
|
||||||
|
|
||||||
|
|
||||||
def get_moto_implementation(service_name):
|
def get_moto_implementation(service_name):
|
||||||
|
@ -6,7 +6,7 @@ from botocore.exceptions import ClientError
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from moto import mock_iam, mock_ec2, mock_s3, mock_sts, mock_elbv2, mock_rds2
|
from moto import mock_iam, mock_ec2, mock_s3, mock_sts, mock_elbv2, mock_rds
|
||||||
from moto.core import set_initial_no_auth_action_count
|
from moto.core import set_initial_no_auth_action_count
|
||||||
from moto.core import ACCOUNT_ID
|
from moto.core import ACCOUNT_ID
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
@ -599,7 +599,7 @@ def test_allowed_with_temporary_credentials():
|
|||||||
@set_initial_no_auth_action_count(3)
|
@set_initial_no_auth_action_count(3)
|
||||||
@mock_iam
|
@mock_iam
|
||||||
@mock_sts
|
@mock_sts
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_access_denied_with_temporary_credentials():
|
def test_access_denied_with_temporary_credentials():
|
||||||
role_name = "test-role"
|
role_name = "test-role"
|
||||||
session_name = "test-session"
|
session_name = "test-session"
|
||||||
|
@ -3,16 +3,16 @@ import pytest
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
|
||||||
from moto import mock_rds2
|
from moto import mock_rds
|
||||||
|
|
||||||
|
|
||||||
class TestDBInstanceFilters(object):
|
class TestDBInstanceFilters(object):
|
||||||
|
|
||||||
mock_rds = mock_rds2()
|
mock = mock_rds()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
cls.mock_rds.start()
|
cls.mock.start()
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
identifier = "db-instance-{}".format(i)
|
identifier = "db-instance-{}".format(i)
|
||||||
@ -27,7 +27,7 @@ class TestDBInstanceFilters(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def teardown_class(cls):
|
def teardown_class(cls):
|
||||||
try:
|
try:
|
||||||
cls.mock_rds.stop()
|
cls.mock.stop()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -179,11 +179,11 @@ class TestDBInstanceFilters(object):
|
|||||||
|
|
||||||
class TestDBSnapshotFilters(object):
|
class TestDBSnapshotFilters(object):
|
||||||
|
|
||||||
mock_rds = mock_rds2()
|
mock = mock_rds()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
cls.mock_rds.start()
|
cls.mock.start()
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
# We'll set up two instances (one postgres, one mysql)
|
# We'll set up two instances (one postgres, one mysql)
|
||||||
# with two snapshots each.
|
# with two snapshots each.
|
||||||
@ -205,7 +205,7 @@ class TestDBSnapshotFilters(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def teardown_class(cls):
|
def teardown_class(cls):
|
||||||
try:
|
try:
|
||||||
cls.mock_rds.stop()
|
cls.mock.stop()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
|||||||
import boto3
|
import boto3
|
||||||
import json
|
import json
|
||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
from moto import mock_cloudformation, mock_ec2, mock_rds2
|
from moto import mock_cloudformation, mock_ec2, mock_rds
|
||||||
from tests.test_cloudformation.fixtures import rds_mysql_with_db_parameter_group
|
from tests.test_cloudformation.fixtures import rds_mysql_with_db_parameter_group
|
||||||
from tests.test_cloudformation.fixtures import rds_mysql_with_read_replica
|
from tests.test_cloudformation.fixtures import rds_mysql_with_read_replica
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
def test_create_subnetgroup_via_cf():
|
def test_create_subnetgroup_via_cf():
|
||||||
vpc_conn = boto3.client("ec2", "us-west-2")
|
vpc_conn = boto3.client("ec2", "us-west-2")
|
||||||
@ -45,7 +45,7 @@ def test_create_subnetgroup_via_cf():
|
|||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
def test_create_dbinstance_via_cf():
|
def test_create_dbinstance_via_cf():
|
||||||
vpc_conn = boto3.client("ec2", "us-west-2")
|
vpc_conn = boto3.client("ec2", "us-west-2")
|
||||||
@ -87,7 +87,7 @@ def test_create_dbinstance_via_cf():
|
|||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
def test_create_dbsecuritygroup_via_cf():
|
def test_create_dbsecuritygroup_via_cf():
|
||||||
vpc_conn = boto3.client("ec2", "us-west-2")
|
vpc_conn = boto3.client("ec2", "us-west-2")
|
||||||
@ -118,7 +118,7 @@ def test_create_dbsecuritygroup_via_cf():
|
|||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_rds_db_parameter_groups():
|
def test_rds_db_parameter_groups():
|
||||||
ec2_conn = boto3.client("ec2", region_name="us-west-1")
|
ec2_conn = boto3.client("ec2", region_name="us-west-1")
|
||||||
ec2_conn.create_security_group(
|
ec2_conn.create_security_group(
|
||||||
@ -168,7 +168,7 @@ def test_rds_db_parameter_groups():
|
|||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_rds_mysql_with_read_replica():
|
def test_rds_mysql_with_read_replica():
|
||||||
ec2_conn = boto3.client("ec2", region_name="us-west-1")
|
ec2_conn = boto3.client("ec2", region_name="us-west-1")
|
||||||
ec2_conn.create_security_group(
|
ec2_conn.create_security_group(
|
||||||
@ -220,7 +220,7 @@ def test_rds_mysql_with_read_replica():
|
|||||||
|
|
||||||
@mock_cloudformation
|
@mock_cloudformation
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_rds_mysql_with_read_replica_in_vpc():
|
def test_rds_mysql_with_read_replica_in_vpc():
|
||||||
template_json = json.dumps(rds_mysql_with_read_replica.template)
|
template_json = json.dumps(rds_mysql_with_read_replica.template)
|
||||||
cf = boto3.client("cloudformation", "eu-central-1")
|
cf = boto3.client("cloudformation", "eu-central-1")
|
@ -3,11 +3,11 @@ import pytest
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from moto import mock_rds2
|
from moto import mock_rds
|
||||||
from moto.core import ACCOUNT_ID
|
from moto.core import ACCOUNT_ID
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_db_cluster_initial():
|
def test_describe_db_cluster_initial():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ def test_describe_db_cluster_initial():
|
|||||||
resp.should.have.key("DBClusters").should.have.length_of(0)
|
resp.should.have.key("DBClusters").should.have.length_of(0)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_needs_master_username():
|
def test_create_db_cluster_needs_master_username():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ def test_create_db_cluster_needs_master_username():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_needs_master_user_password():
|
def test_create_db_cluster_needs_master_user_password():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ def test_create_db_cluster_needs_master_user_password():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_needs_long_master_user_password():
|
def test_create_db_cluster_needs_long_master_user_password():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ def test_create_db_cluster_needs_long_master_user_password():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster__verify_default_properties():
|
def test_create_db_cluster__verify_default_properties():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ def test_create_db_cluster__verify_default_properties():
|
|||||||
cluster.should.have.key("ClusterCreateTime")
|
cluster.should.have.key("ClusterCreateTime")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_with_database_name():
|
def test_create_db_cluster_with_database_name():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ def test_create_db_cluster_with_database_name():
|
|||||||
cluster.should.have.key("DBClusterParameterGroup").equal("default.aurora8.0")
|
cluster.should.have.key("DBClusterParameterGroup").equal("default.aurora8.0")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_additional_parameters():
|
def test_create_db_cluster_additional_parameters():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ def test_create_db_cluster_additional_parameters():
|
|||||||
cluster.should.have.key("DeletionProtection").equal(True)
|
cluster.should.have.key("DeletionProtection").equal(True)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_db_cluster_after_creation():
|
def test_describe_db_cluster_after_creation():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ def test_describe_db_cluster_after_creation():
|
|||||||
].should.have.length_of(1)
|
].should.have.length_of(1)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_db_cluster():
|
def test_delete_db_cluster():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ def test_delete_db_cluster():
|
|||||||
client.describe_db_clusters()["DBClusters"].should.have.length_of(0)
|
client.describe_db_clusters()["DBClusters"].should.have.length_of(0)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_db_cluster_that_is_protected():
|
def test_delete_db_cluster_that_is_protected():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ def test_delete_db_cluster_that_is_protected():
|
|||||||
err["Message"].should.equal("Can't delete Cluster with protection enabled")
|
err["Message"].should.equal("Can't delete Cluster with protection enabled")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_db_cluster_unknown_cluster():
|
def test_delete_db_cluster_unknown_cluster():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ def test_delete_db_cluster_unknown_cluster():
|
|||||||
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_db_cluster_unknown_cluster():
|
def test_start_db_cluster_unknown_cluster():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ def test_start_db_cluster_unknown_cluster():
|
|||||||
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_db_cluster_after_stopping():
|
def test_start_db_cluster_after_stopping():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ def test_start_db_cluster_after_stopping():
|
|||||||
cluster["Status"].should.equal("available")
|
cluster["Status"].should.equal("available")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_db_cluster_without_stopping():
|
def test_start_db_cluster_without_stopping():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ def test_start_db_cluster_without_stopping():
|
|||||||
err["Message"].should.equal("DbCluster cluster-id is not in stopped state.")
|
err["Message"].should.equal("DbCluster cluster-id is not in stopped state.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_stop_db_cluster():
|
def test_stop_db_cluster():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ def test_stop_db_cluster():
|
|||||||
cluster["Status"].should.equal("stopped")
|
cluster["Status"].should.equal("stopped")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_stop_db_cluster_already_stopped():
|
def test_stop_db_cluster_already_stopped():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ def test_stop_db_cluster_already_stopped():
|
|||||||
err["Message"].should.equal("DbCluster cluster-id is not in available state.")
|
err["Message"].should.equal("DbCluster cluster-id is not in available state.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_stop_db_cluster_unknown_cluster():
|
def test_stop_db_cluster_unknown_cluster():
|
||||||
client = boto3.client("rds", region_name="eu-north-1")
|
client = boto3.client("rds", region_name="eu-north-1")
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ def test_stop_db_cluster_unknown_cluster():
|
|||||||
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
err["Message"].should.equal("DBCluster cluster-unknown not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_snapshot_fails_for_unknown_cluster():
|
def test_create_db_cluster_snapshot_fails_for_unknown_cluster():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
with pytest.raises(ClientError) as exc:
|
with pytest.raises(ClientError) as exc:
|
||||||
@ -348,7 +348,7 @@ def test_create_db_cluster_snapshot_fails_for_unknown_cluster():
|
|||||||
err["Message"].should.equal("DBCluster db-primary-1 not found.")
|
err["Message"].should.equal("DBCluster db-primary-1 not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_snapshot():
|
def test_create_db_cluster_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
conn.create_db_cluster(
|
conn.create_db_cluster(
|
||||||
@ -373,7 +373,7 @@ def test_create_db_cluster_snapshot():
|
|||||||
result["TagList"].should.equal([])
|
result["TagList"].should.equal([])
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_db_cluster_snapshot_copy_tags():
|
def test_create_db_cluster_snapshot_copy_tags():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ def test_create_db_cluster_snapshot_copy_tags():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot():
|
def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot():
|
|||||||
err["Message"].should.equal("DBClusterSnapshot snapshot-1 not found.")
|
err["Message"].should.equal("DBClusterSnapshot snapshot-1 not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_copy_db_cluster_snapshot():
|
def test_copy_db_cluster_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ def test_copy_db_cluster_snapshot():
|
|||||||
result["TagList"].should.equal([])
|
result["TagList"].should.equal([])
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
|
def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_db_cluster_snapshots():
|
def test_describe_db_cluster_snapshots():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
conn.create_db_cluster(
|
conn.create_db_cluster(
|
||||||
@ -527,7 +527,7 @@ def test_describe_db_cluster_snapshots():
|
|||||||
snapshots.should.have.length_of(2)
|
snapshots.should.have.length_of(2)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_db_cluster_snapshot():
|
def test_delete_db_cluster_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
conn.create_db_cluster(
|
conn.create_db_cluster(
|
||||||
@ -551,7 +551,7 @@ def test_delete_db_cluster_snapshot():
|
|||||||
).should.throw(ClientError)
|
).should.throw(ClientError)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_restore_db_cluster_from_snapshot():
|
def test_restore_db_cluster_from_snapshot():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
conn.create_db_cluster(
|
conn.create_db_cluster(
|
||||||
@ -590,7 +590,7 @@ def test_restore_db_cluster_from_snapshot():
|
|||||||
].should.have.length_of(1)
|
].should.have.length_of(1)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_restore_db_cluster_from_snapshot_and_override_params():
|
def test_restore_db_cluster_from_snapshot_and_override_params():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
conn.create_db_cluster(
|
conn.create_db_cluster(
|
@ -3,7 +3,7 @@ import pytest
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from moto import mock_rds2
|
from moto import mock_rds
|
||||||
from moto.core import ACCOUNT_ID
|
from moto.core import ACCOUNT_ID
|
||||||
|
|
||||||
DB_INSTANCE_IDENTIFIER = "db-primary-1"
|
DB_INSTANCE_IDENTIFIER = "db-primary-1"
|
||||||
@ -24,7 +24,7 @@ def _prepare_db_instance(client):
|
|||||||
return resp["DBInstance"]["DBInstanceIdentifier"]
|
return resp["DBInstance"]["DBInstanceIdentifier"]
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_event_subscription():
|
def test_create_event_subscription():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
db_identifier = _prepare_db_instance(client)
|
db_identifier = _prepare_db_instance(client)
|
||||||
@ -56,7 +56,7 @@ def test_create_event_subscription():
|
|||||||
es["Enabled"].should.equal(False)
|
es["Enabled"].should.equal(False)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_create_event_fail_already_exists():
|
def test_create_event_fail_already_exists():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
db_identifier = _prepare_db_instance(client)
|
db_identifier = _prepare_db_instance(client)
|
||||||
@ -79,7 +79,7 @@ def test_create_event_fail_already_exists():
|
|||||||
err["Message"].should.equal("Subscription db-primary-1-events already exists.")
|
err["Message"].should.equal("Subscription db-primary-1-events already exists.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_event_subscription_fails_unknown_subscription():
|
def test_delete_event_subscription_fails_unknown_subscription():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
with pytest.raises(ClientError) as ex:
|
with pytest.raises(ClientError) as ex:
|
||||||
@ -90,7 +90,7 @@ def test_delete_event_subscription_fails_unknown_subscription():
|
|||||||
err["Message"].should.equal("Subscription my-db-events not found.")
|
err["Message"].should.equal("Subscription my-db-events not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_delete_event_subscription():
|
def test_delete_event_subscription():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
db_identifier = _prepare_db_instance(client)
|
db_identifier = _prepare_db_instance(client)
|
||||||
@ -110,7 +110,7 @@ def test_delete_event_subscription():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_event_subscriptions():
|
def test_describe_event_subscriptions():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
db_identifier = _prepare_db_instance(client)
|
db_identifier = _prepare_db_instance(client)
|
||||||
@ -126,7 +126,7 @@ def test_describe_event_subscriptions():
|
|||||||
subscriptions[0]["CustSubscriptionId"].should.equal(f"{db_identifier}-events")
|
subscriptions[0]["CustSubscriptionId"].should.equal(f"{db_identifier}-events")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_event_subscriptions_fails_unknown_subscription():
|
def test_describe_event_subscriptions_fails_unknown_subscription():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
with pytest.raises(ClientError) as ex:
|
with pytest.raises(ClientError) as ex:
|
@ -3,7 +3,7 @@ import pytest
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from moto import mock_rds2
|
from moto import mock_rds
|
||||||
from moto.core import ACCOUNT_ID
|
from moto.core import ACCOUNT_ID
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ def _prepare_db_snapshot(client, snapshot_name="snapshot-1"):
|
|||||||
return resp["DBSnapshot"]["DBSnapshotArn"]
|
return resp["DBSnapshot"]["DBSnapshotArn"]
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_export_task_fails_unknown_snapshot():
|
def test_start_export_task_fails_unknown_snapshot():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ def test_start_export_task_fails_unknown_snapshot():
|
|||||||
err["Message"].should.equal("DBSnapshot snapshot-1 not found.")
|
err["Message"].should.equal("DBSnapshot snapshot-1 not found.")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_export_task():
|
def test_start_export_task():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
source_arn = _prepare_db_snapshot(client)
|
source_arn = _prepare_db_snapshot(client)
|
||||||
@ -69,7 +69,7 @@ def test_start_export_task():
|
|||||||
export["ExportOnly"].should.equal(["schema.table"])
|
export["ExportOnly"].should.equal(["schema.table"])
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_start_export_task_fail_already_exists():
|
def test_start_export_task_fail_already_exists():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
source_arn = _prepare_db_snapshot(client)
|
source_arn = _prepare_db_snapshot(client)
|
||||||
@ -97,7 +97,7 @@ def test_start_export_task_fail_already_exists():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_cancel_export_task_fails_unknown_task():
|
def test_cancel_export_task_fails_unknown_task():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
with pytest.raises(ClientError) as ex:
|
with pytest.raises(ClientError) as ex:
|
||||||
@ -110,7 +110,7 @@ def test_cancel_export_task_fails_unknown_task():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_cancel_export_task():
|
def test_cancel_export_task():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
source_arn = _prepare_db_snapshot(client)
|
source_arn = _prepare_db_snapshot(client)
|
||||||
@ -129,7 +129,7 @@ def test_cancel_export_task():
|
|||||||
export["Status"].should.equal("canceled")
|
export["Status"].should.equal("canceled")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_export_tasks():
|
def test_describe_export_tasks():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
source_arn = _prepare_db_snapshot(client)
|
source_arn = _prepare_db_snapshot(client)
|
||||||
@ -147,7 +147,7 @@ def test_describe_export_tasks():
|
|||||||
exports[0]["ExportTaskIdentifier"].should.equal("export-snapshot-1")
|
exports[0]["ExportTaskIdentifier"].should.equal("export-snapshot-1")
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
def test_describe_export_tasks_fails_unknown_task():
|
def test_describe_export_tasks_fails_unknown_task():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
with pytest.raises(ClientError) as ex:
|
with pytest.raises(ClientError) as ex:
|
@ -1,14 +1,7 @@
|
|||||||
|
import moto.server as server
|
||||||
import sure # noqa # pylint: disable=unused-import
|
import sure # noqa # pylint: disable=unused-import
|
||||||
|
|
||||||
import moto.server as server
|
|
||||||
from moto import mock_rds
|
|
||||||
|
|
||||||
"""
|
|
||||||
Test the different server responses
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
@mock_rds
|
|
||||||
def test_list_databases():
|
def test_list_databases():
|
||||||
backend = server.create_backend_app("rds")
|
backend = server.create_backend_app("rds")
|
||||||
test_client = backend.test_client()
|
test_client = backend.test_client()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from moto.rds2.utils import (
|
from moto.rds.utils import (
|
||||||
FilterDef,
|
FilterDef,
|
||||||
apply_filter,
|
apply_filter,
|
||||||
merge_filters,
|
merge_filters,
|
@ -1 +0,0 @@
|
|||||||
# This file is intentionally left blank.
|
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +0,0 @@
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
|
||||||
|
|
||||||
"""
|
|
||||||
Test the different server responses
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
# @mock_rds2
|
|
||||||
# def test_list_databases():
|
|
||||||
# backend = server.create_backend_app("rds2")
|
|
||||||
# test_client = backend.test_client()
|
|
||||||
#
|
|
||||||
# res = test_client.get('/?Action=DescribeDBInstances')
|
|
||||||
#
|
|
||||||
# res.data.decode("utf-8").should.contain("<DescribeDBInstancesResult>")
|
|
@ -3,7 +3,7 @@ import sure # noqa # pylint: disable=unused-import
|
|||||||
from moto import mock_ec2
|
from moto import mock_ec2
|
||||||
from moto import mock_elbv2
|
from moto import mock_elbv2
|
||||||
from moto import mock_kms
|
from moto import mock_kms
|
||||||
from moto import mock_rds2
|
from moto import mock_rds
|
||||||
from moto import mock_resourcegroupstaggingapi
|
from moto import mock_resourcegroupstaggingapi
|
||||||
from moto import mock_s3
|
from moto import mock_s3
|
||||||
from moto import mock_lambda
|
from moto import mock_lambda
|
||||||
@ -12,7 +12,7 @@ from botocore.client import ClientError
|
|||||||
from tests import EXAMPLE_AMI_ID, EXAMPLE_AMI_ID2
|
from tests import EXAMPLE_AMI_ID, EXAMPLE_AMI_ID2
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_resourcegroupstaggingapi
|
@mock_resourcegroupstaggingapi
|
||||||
def test_get_resources_ec2():
|
def test_get_resources_ec2():
|
||||||
@ -379,7 +379,7 @@ def test_multiple_tag_filters():
|
|||||||
instance_2_id.shouldnt.be.within(results[0]["ResourceARN"])
|
instance_2_id.shouldnt.be.within(results[0]["ResourceARN"])
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds
|
||||||
@mock_resourcegroupstaggingapi
|
@mock_resourcegroupstaggingapi
|
||||||
def test_get_resources_rds():
|
def test_get_resources_rds():
|
||||||
client = boto3.client("rds", region_name="us-west-2")
|
client = boto3.client("rds", region_name="us-west-2")
|
||||||
|
Loading…
Reference in New Issue
Block a user