2022-11-17 02:58:24 +00:00
|
|
|
from urllib.parse import urlencode
|
2023-11-30 15:55:51 +00:00
|
|
|
|
2015-01-09 03:18:06 +00: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 07:42:19 +00: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-17 02:58:24 +00:00
|
|
|
params = {
|
|
|
|
"Action": "CreateDBInstance",
|
2022-05-11 09:15:28 +00:00
|
|
|
"DBInstanceIdentifier": "hi",
|
|
|
|
"DBInstanceClass": "db.m4.large",
|
2023-11-13 10:24:32 +00:00
|
|
|
"Engine": "aurora-mysql",
|
2022-05-11 09:15:28 +00:00
|
|
|
"StorageType": "standard",
|
|
|
|
"Port": 3306,
|
|
|
|
}
|
2022-11-17 02:58:24 +00:00
|
|
|
qs = urlencode(params)
|
|
|
|
resp = test_client.post(f"/?{qs}")
|
2022-05-11 09:15:28 +00:00
|
|
|
|
2022-11-17 02:58:24 +00:00
|
|
|
response = resp.data.decode("utf-8")
|
2023-08-17 07:42:19 +00: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 07:42:19 +00:00
|
|
|
assert "<MultiAZ>false</MultiAZ>" in response
|
|
|
|
assert (
|
2022-05-25 09:21:03 +00:00
|
|
|
"<IAMDatabaseAuthenticationEnabled>false</IAMDatabaseAuthenticationEnabled>"
|
2023-08-17 07:42:19 +00:00
|
|
|
) in response
|