From 1c8d1aec2e8cc3634d49b4549802829cb68df13c Mon Sep 17 00:00:00 2001 From: Danish Amjad Date: Fri, 16 Jun 2023 16:12:23 +0200 Subject: [PATCH] DMS: Fix TableMappings and ReplicationTaskSettings format. (#6396) --- moto/dms/models.py | 6 ++---- tests/test_dms/test_dms.py | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/moto/dms/models.py b/moto/dms/models.py index 2a174a7d3..87fbf9017 100644 --- a/moto/dms/models.py +++ b/moto/dms/models.py @@ -1,5 +1,3 @@ -import json - from datetime import datetime from typing import Any, Dict, List, Iterable, Optional from moto.core import BaseBackend, BackendDict, BaseModel @@ -142,8 +140,8 @@ class FakeReplicationTask(BaseModel): "TargetEndpointArn": self.target_endpoint_arn, "ReplicationInstanceArn": self.replication_instance_arn, "MigrationType": self.migration_type, - "TableMappings": json.dumps(self.table_mappings), - "ReplicationTaskSettings": json.dumps(self.replication_task_settings), + "TableMappings": self.table_mappings, + "ReplicationTaskSettings": self.replication_task_settings, "Status": self.status, "ReplicationTaskCreationDate": self.creation_date.isoformat(), "ReplicationTaskStartDate": start_date, diff --git a/tests/test_dms/test_dms.py b/tests/test_dms/test_dms.py index f94c7ce66..037a307d9 100644 --- a/tests/test_dms/test_dms.py +++ b/tests/test_dms/test_dms.py @@ -2,6 +2,7 @@ from botocore.exceptions import ClientError import boto3 import sure # noqa # pylint: disable=unused-import import pytest +import json from moto import mock_dms @@ -17,6 +18,7 @@ def test_create_and_get_replication_task(): ReplicationInstanceArn="replication-instance-arn", MigrationType="full-load", TableMappings='{"rules":[]}', + ReplicationTaskSettings='{"Logging":{} }', ) tasks = client.describe_replication_tasks( @@ -31,6 +33,11 @@ def test_create_and_get_replication_task(): task["ReplicationInstanceArn"].should.equal("replication-instance-arn") task["MigrationType"].should.equal("full-load") task["Status"].should.equal("creating") + task["TableMappings"].should.equal('{"rules":[]}') + json.loads(task["TableMappings"]).should.be.a(dict) + + task["ReplicationTaskSettings"].should.equal('{"Logging":{} }') + json.loads(task["ReplicationTaskSettings"]).should.be.a(dict) @mock_dms