2022-11-16 18:58:24 -08:00
|
|
|
from urllib.parse import urlencode
|
2023-11-30 07:55:51 -08:00
|
|
|
|
2015-01-08 22:18:06 -05:00
|
|
|
import moto.server as server
|
|
|
|
|
|
|
|
|
|
|
|
def test_list_databases():
|
|
|
|
backend = server.create_backend_app("rds")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
|
|
|
res = test_client.get("/?Action=DescribeDBInstances")
|
|
|
|
|
2023-08-17 03:42:19 -04:00
|
|
|
assert "<DescribeDBInstancesResult>" in res.data.decode("utf-8")
|
2022-05-11 09:15:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_create_db_instance():
|
|
|
|
backend = server.create_backend_app("rds")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
2022-11-16 18:58:24 -08:00
|
|
|
params = {
|
|
|
|
"Action": "CreateDBInstance",
|
2022-05-11 09:15:28 +00:00
|
|
|
"DBInstanceIdentifier": "hi",
|
|
|
|
"DBInstanceClass": "db.m4.large",
|
2023-11-13 19:24:32 +09:00
|
|
|
"Engine": "aurora-mysql",
|
2022-05-11 09:15:28 +00:00
|
|
|
"StorageType": "standard",
|
|
|
|
"Port": 3306,
|
|
|
|
}
|
2022-11-16 18:58:24 -08:00
|
|
|
qs = urlencode(params)
|
|
|
|
resp = test_client.post(f"/?{qs}")
|
2022-05-11 09:15:28 +00:00
|
|
|
|
2022-11-16 18:58:24 -08:00
|
|
|
response = resp.data.decode("utf-8")
|
2023-08-17 03:42:19 -04:00
|
|
|
assert "<DBClusterIdentifier>" not in response
|
|
|
|
assert "<DBInstanceIdentifier>hi</DBInstanceIdentifier" in response
|
2022-05-25 09:21:03 +00:00
|
|
|
# We do not pass these values - they should default to false
|
2023-08-17 03:42:19 -04:00
|
|
|
assert "<MultiAZ>false</MultiAZ>" in response
|
|
|
|
assert (
|
2022-05-25 09:21:03 +00:00
|
|
|
"<IAMDatabaseAuthenticationEnabled>false</IAMDatabaseAuthenticationEnabled>"
|
2023-08-17 03:42:19 -04:00
|
|
|
) in response
|