DMS: Fix TableMappings and ReplicationTaskSettings format. (#6396)

This commit is contained in:
Danish Amjad 2023-06-16 16:12:23 +02:00 committed by GitHub
parent 3741058242
commit 1c8d1aec2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,3 @@
import json
from datetime import datetime from datetime import datetime
from typing import Any, Dict, List, Iterable, Optional from typing import Any, Dict, List, Iterable, Optional
from moto.core import BaseBackend, BackendDict, BaseModel from moto.core import BaseBackend, BackendDict, BaseModel
@ -142,8 +140,8 @@ class FakeReplicationTask(BaseModel):
"TargetEndpointArn": self.target_endpoint_arn, "TargetEndpointArn": self.target_endpoint_arn,
"ReplicationInstanceArn": self.replication_instance_arn, "ReplicationInstanceArn": self.replication_instance_arn,
"MigrationType": self.migration_type, "MigrationType": self.migration_type,
"TableMappings": json.dumps(self.table_mappings), "TableMappings": self.table_mappings,
"ReplicationTaskSettings": json.dumps(self.replication_task_settings), "ReplicationTaskSettings": self.replication_task_settings,
"Status": self.status, "Status": self.status,
"ReplicationTaskCreationDate": self.creation_date.isoformat(), "ReplicationTaskCreationDate": self.creation_date.isoformat(),
"ReplicationTaskStartDate": start_date, "ReplicationTaskStartDate": start_date,

View File

@ -2,6 +2,7 @@ from botocore.exceptions import ClientError
import boto3 import boto3
import sure # noqa # pylint: disable=unused-import import sure # noqa # pylint: disable=unused-import
import pytest import pytest
import json
from moto import mock_dms from moto import mock_dms
@ -17,6 +18,7 @@ def test_create_and_get_replication_task():
ReplicationInstanceArn="replication-instance-arn", ReplicationInstanceArn="replication-instance-arn",
MigrationType="full-load", MigrationType="full-load",
TableMappings='{"rules":[]}', TableMappings='{"rules":[]}',
ReplicationTaskSettings='{"Logging":{} }',
) )
tasks = client.describe_replication_tasks( tasks = client.describe_replication_tasks(
@ -31,6 +33,11 @@ def test_create_and_get_replication_task():
task["ReplicationInstanceArn"].should.equal("replication-instance-arn") task["ReplicationInstanceArn"].should.equal("replication-instance-arn")
task["MigrationType"].should.equal("full-load") task["MigrationType"].should.equal("full-load")
task["Status"].should.equal("creating") 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 @mock_dms