Remove more DynamoDB2 references (#4933)
This commit is contained in:
parent
eed32a5f72
commit
382ff2b1a9
3
setup.py
3
setup.py
@ -102,7 +102,8 @@ extras_per_service.update(
|
||||
)
|
||||
|
||||
# When a Table has a Stream, we'll always need to import AWSLambda to search for a corresponding function to send the table data to
|
||||
extras_per_service["dynamodb2"] = extras_per_service["awslambda"]
|
||||
extras_per_service["dynamodb"] = extras_per_service["awslambda"]
|
||||
extras_per_service["dynamodb2"] = extras_per_service["dynamodb"]
|
||||
extras_per_service["dynamodbstreams"] = extras_per_service["awslambda"]
|
||||
# EFS depends on EC2 to find subnets etc
|
||||
extras_per_service["efs"] = extras_per_service["ec2"]
|
||||
|
@ -2,7 +2,7 @@ import boto3
|
||||
import json
|
||||
import requests
|
||||
|
||||
from moto import mock_apigateway, mock_dynamodb2
|
||||
from moto import mock_apigateway, mock_dynamodb
|
||||
from moto import settings
|
||||
from moto.core.models import responses_mock
|
||||
from unittest import SkipTest
|
||||
@ -54,7 +54,7 @@ def test_http_integration():
|
||||
|
||||
|
||||
@mock_apigateway
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_aws_integration_dynamodb():
|
||||
if settings.TEST_SERVER_MODE:
|
||||
raise SkipTest("Cannot test mock of execute-api.apigateway in ServerMode")
|
||||
@ -79,7 +79,7 @@ def test_aws_integration_dynamodb():
|
||||
|
||||
|
||||
@mock_apigateway
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_aws_integration_dynamodb_multiple_stages():
|
||||
if settings.TEST_SERVER_MODE:
|
||||
raise SkipTest("Cannot test mock of execute-api.apigateway in ServerMode")
|
||||
@ -116,7 +116,7 @@ def test_aws_integration_dynamodb_multiple_stages():
|
||||
|
||||
|
||||
@mock_apigateway
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_aws_integration_dynamodb_multiple_resources():
|
||||
if settings.TEST_SERVER_MODE:
|
||||
raise SkipTest("Cannot test mock of execute-api.apigateway in ServerMode")
|
||||
|
@ -6,7 +6,7 @@ import time
|
||||
import sure # noqa # pylint: disable=unused-import
|
||||
import uuid
|
||||
|
||||
from moto import mock_dynamodb2, mock_lambda, mock_logs, mock_sns, mock_sqs
|
||||
from moto import mock_dynamodb, mock_lambda, mock_logs, mock_sns, mock_sqs
|
||||
from uuid import uuid4
|
||||
from .utilities import (
|
||||
get_role_name,
|
||||
@ -97,7 +97,7 @@ def test_invoke_function_from_sqs(key):
|
||||
@pytest.mark.network
|
||||
@mock_logs
|
||||
@mock_lambda
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_invoke_function_from_dynamodb_put():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
table_name = str(uuid4())[0:6] + "_table"
|
||||
@ -148,7 +148,7 @@ def test_invoke_function_from_dynamodb_put():
|
||||
@pytest.mark.network
|
||||
@mock_logs
|
||||
@mock_lambda
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_invoke_function_from_dynamodb_update():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
table_name = str(uuid4())[0:6] + "_table"
|
||||
|
@ -14,7 +14,7 @@ from unittest import SkipTest
|
||||
|
||||
from moto import (
|
||||
mock_cloudformation,
|
||||
mock_dynamodb2,
|
||||
mock_dynamodb,
|
||||
mock_s3,
|
||||
mock_sns,
|
||||
mock_sqs,
|
||||
@ -2113,7 +2113,7 @@ def test_boto3_create_duplicate_stack():
|
||||
cf_conn.create_stack(StackName="test_stack", TemplateBody=dummy_template_json)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
@mock_cloudformation
|
||||
def test_delete_stack_dynamo_template():
|
||||
conn = boto3.client("cloudformation", region_name="us-east-1")
|
||||
@ -2127,7 +2127,7 @@ def test_delete_stack_dynamo_template():
|
||||
conn.create_stack(StackName="test_stack", TemplateBody=dummy_template_json4)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
@mock_cloudformation
|
||||
@mock_lambda
|
||||
def test_create_stack_lambda_and_dynamodb():
|
||||
|
@ -13,7 +13,7 @@ from string import Template
|
||||
from moto import (
|
||||
mock_autoscaling,
|
||||
mock_cloudformation,
|
||||
mock_dynamodb2,
|
||||
mock_dynamodb,
|
||||
mock_ec2,
|
||||
mock_events,
|
||||
mock_kms,
|
||||
@ -986,7 +986,7 @@ def test_stack_elbv2_resources_integration():
|
||||
name["OutputValue"].should.equal(load_balancers[0]["LoadBalancerName"])
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
@mock_cloudformation
|
||||
def test_stack_dynamodb_resources_integration():
|
||||
dynamodb_template = {
|
||||
@ -1628,7 +1628,7 @@ def test_stack_events_get_attribute_integration():
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_dynamodb_table_creation():
|
||||
CFN_TEMPLATE = {
|
||||
"Outputs": {"MyTableName": {"Value": {"Ref": "MyTable"}}},
|
||||
|
@ -2,7 +2,7 @@ import boto3
|
||||
import mock
|
||||
import os
|
||||
import pytest
|
||||
from moto import mock_dynamodb2, mock_sns, settings
|
||||
from moto import mock_dynamodb, mock_sns, settings
|
||||
from unittest import SkipTest
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ def test_use_unknown_region_from_env_but_allow_it():
|
||||
client.list_platform_applications()["PlatformApplications"].should.equal([])
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
@mock.patch.dict(os.environ, {"MOTO_ALLOW_NONEXISTENT_REGION": "trUe"})
|
||||
def test_use_unknown_region_from_env_but_allow_it__dynamo():
|
||||
if settings.TEST_SERVER_MODE:
|
||||
|
@ -1,10 +1,10 @@
|
||||
import unittest
|
||||
from moto import mock_dynamodb2
|
||||
from moto import mock_dynamodb
|
||||
import socket
|
||||
|
||||
|
||||
class TestSocketPair(unittest.TestCase):
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_socket_pair(self):
|
||||
a, b = socket.socketpair()
|
||||
self.assertIsNotNone(a)
|
||||
|
@ -3,7 +3,7 @@ import pytest
|
||||
import sure # noqa # pylint: disable=unused-import
|
||||
from boto3.dynamodb.conditions import Key
|
||||
from botocore.exceptions import ClientError
|
||||
from moto import mock_dynamodb2
|
||||
from moto import mock_dynamodb
|
||||
|
||||
table_schema = {
|
||||
"KeySchema": [{"AttributeName": "partitionKey", "KeyType": "HASH"}],
|
||||
@ -25,7 +25,7 @@ table_schema = {
|
||||
}
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_query_gsi_with_wrong_key_attribute_names_throws_exception():
|
||||
item = {
|
||||
"partitionKey": "pk-1",
|
||||
@ -98,7 +98,7 @@ def test_query_gsi_with_wrong_key_attribute_names_throws_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_empty_expressionattributenames():
|
||||
ddb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
ddb.create_table(
|
||||
@ -114,7 +114,7 @@ def test_empty_expressionattributenames():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_empty_expressionattributenames_with_empty_projection():
|
||||
ddb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
ddb.create_table(
|
||||
@ -130,7 +130,7 @@ def test_empty_expressionattributenames_with_empty_projection():
|
||||
err["Message"].should.equal("ExpressionAttributeNames must not be empty")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_empty_expressionattributenames_with_projection():
|
||||
ddb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
ddb.create_table(
|
||||
@ -146,7 +146,7 @@ def test_empty_expressionattributenames_with_projection():
|
||||
err["Message"].should.equal("ExpressionAttributeNames must not be empty")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_update_item_range_key_set():
|
||||
ddb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -168,7 +168,7 @@ def test_update_item_range_key_set():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_batch_get_item_non_existing_table():
|
||||
|
||||
client = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -180,7 +180,7 @@ def test_batch_get_item_non_existing_table():
|
||||
assert err["Message"].should.equal("Requested resource not found")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_batch_write_item_non_existing_table():
|
||||
client = boto3.client("dynamodb", region_name="us-west-2")
|
||||
|
||||
@ -194,7 +194,7 @@ def test_batch_write_item_non_existing_table():
|
||||
assert err["Message"].should.equal("Requested resource not found")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_create_table_with_redundant_attributes():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -241,7 +241,7 @@ def test_create_table_with_redundant_attributes():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_create_table_with_missing_attributes():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -284,7 +284,7 @@ def test_create_table_with_missing_attributes():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_create_table_with_redundant_and_missing_attributes():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -327,7 +327,7 @@ def test_create_table_with_redundant_and_missing_attributes():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_put_item_wrong_attribute_type():
|
||||
dynamodb = boto3.client("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -373,7 +373,7 @@ def test_put_item_wrong_attribute_type():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
# https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression
|
||||
def test_hash_key_cannot_use_begins_with_operations():
|
||||
dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
@ -404,7 +404,7 @@ def test_hash_key_cannot_use_begins_with_operations():
|
||||
|
||||
|
||||
# Test this again, but with manually supplying an operator
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
@pytest.mark.parametrize("operator", ["<", "<=", ">", ">="])
|
||||
def test_hash_key_can_only_use_equals_operations(operator):
|
||||
dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
@ -426,7 +426,7 @@ def test_hash_key_can_only_use_equals_operations(operator):
|
||||
err["Message"].should.equal("Query key condition not supported")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_creating_table_with_0_local_indexes():
|
||||
dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -445,7 +445,7 @@ def test_creating_table_with_0_local_indexes():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_creating_table_with_0_global_indexes():
|
||||
dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
|
||||
@ -464,7 +464,7 @@ def test_creating_table_with_0_global_indexes():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_multiple_transactions_on_same_item():
|
||||
table_schema = {
|
||||
"KeySchema": [{"AttributeName": "id", "KeyType": "HASH"}],
|
||||
@ -502,7 +502,7 @@ def test_multiple_transactions_on_same_item():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_transact_write_items__too_many_transactions():
|
||||
table_schema = {
|
||||
"KeySchema": [{"AttributeName": "pk", "KeyType": "HASH"}],
|
||||
@ -534,7 +534,7 @@ def test_transact_write_items__too_many_transactions():
|
||||
err["Message"].should.match("Member must have length less than or equal to 25")
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_update_item_non_existent_table():
|
||||
client = boto3.client("dynamodb", region_name="us-west-2")
|
||||
with pytest.raises(client.exceptions.ResourceNotFoundException) as exc:
|
||||
|
@ -4,12 +4,12 @@ import boto3
|
||||
import sure # noqa # pylint: disable=unused-import
|
||||
import pytest
|
||||
|
||||
from moto import mock_dynamodb2
|
||||
from moto import mock_dynamodb
|
||||
from botocore.exceptions import ClientError
|
||||
from moto.dynamodb.limits import HASH_KEY_MAX_LENGTH, RANGE_KEY_MAX_LENGTH
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_item_add_long_string_hash_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -50,7 +50,7 @@ def test_item_add_long_string_hash_key_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_item_add_long_string_nonascii_hash_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -97,7 +97,7 @@ def test_item_add_long_string_nonascii_hash_key_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_item_add_long_string_range_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -144,7 +144,7 @@ def test_item_add_long_string_range_key_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_put_long_string_gsi_range_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -213,7 +213,7 @@ def test_put_long_string_gsi_range_key_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_update_item_with_long_string_hash_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
@ -253,7 +253,7 @@ def test_update_item_with_long_string_hash_key_exception():
|
||||
)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_update_item_with_long_string_range_key_exception():
|
||||
name = "TestTable"
|
||||
conn = boto3.client("dynamodb", region_name="us-west-2")
|
||||
|
@ -1,4 +1,4 @@
|
||||
from moto import mock_xray_client, XRaySegment, mock_dynamodb2
|
||||
from moto import mock_xray_client, XRaySegment, mock_dynamodb
|
||||
import sure # noqa # pylint: disable=unused-import
|
||||
import boto3
|
||||
|
||||
@ -19,7 +19,7 @@ original_session_prep_request = requests.Session.prepare_request
|
||||
|
||||
|
||||
@mock_xray_client
|
||||
@mock_dynamodb2
|
||||
@mock_dynamodb
|
||||
def test_xray_dynamo_request_id():
|
||||
# Could be ran in any order, so we need to tell sdk that its been unpatched
|
||||
xray_core_patcher._PATCHED_MODULES = set()
|
||||
@ -48,7 +48,7 @@ def test_xray_dynamo_request_id():
|
||||
def test_xray_dynamo_request_id_with_context_mgr():
|
||||
with mock_xray_client():
|
||||
assert isinstance(xray_core.xray_recorder._emitter, MockEmitter)
|
||||
with mock_dynamodb2():
|
||||
with mock_dynamodb():
|
||||
# Could be ran in any order, so we need to tell sdk that its been unpatched
|
||||
xray_core_patcher._PATCHED_MODULES = set()
|
||||
xray_core.patch_all()
|
||||
|
Loading…
x
Reference in New Issue
Block a user