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 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,

View File

@ -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