2022-03-31 12:26:17 +00:00
|
|
|
import boto3
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
from moto import mock_aws
|
2022-08-13 09:49:43 +00:00
|
|
|
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
|
2022-03-31 12:26:17 +00:00
|
|
|
|
|
|
|
# See our Development Tips on writing tests for hints on how to write good tests:
|
|
|
|
# http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html
|
|
|
|
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
@mock_aws
|
2022-03-31 12:26:17 +00:00
|
|
|
def test_create_data_set():
|
|
|
|
client = boto3.client("quicksight", region_name="eu-west-1")
|
|
|
|
|
|
|
|
resp = client.create_data_set(
|
|
|
|
AwsAccountId=ACCOUNT_ID,
|
|
|
|
DataSetId="myset",
|
|
|
|
Name="My Data Set",
|
|
|
|
ImportMode="SPICE",
|
|
|
|
PhysicalTableMap={
|
|
|
|
"table1": {
|
|
|
|
"RelationalTable": {
|
|
|
|
"DataSourceArn": "d:s:arn",
|
|
|
|
"Catalog": "cat",
|
|
|
|
"Name": "dog",
|
|
|
|
"InputColumns": [{"Name": "c1", "Type": "string"}],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2023-08-17 07:28:50 +00:00
|
|
|
assert resp["Arn"] == (f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/myset")
|
|
|
|
assert resp["DataSetId"] == "myset"
|
|
|
|
assert resp["IngestionArn"] == (
|
2022-03-31 12:26:17 +00:00
|
|
|
f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:ingestion/tbd"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
@mock_aws
|
2022-03-31 12:26:17 +00:00
|
|
|
def test_create_ingestion():
|
|
|
|
client = boto3.client("quicksight", region_name="eu-west-1")
|
|
|
|
|
|
|
|
client.create_data_set(
|
|
|
|
AwsAccountId=ACCOUNT_ID,
|
|
|
|
DataSetId="myset",
|
|
|
|
Name="My Data Set",
|
|
|
|
ImportMode="SPICE",
|
|
|
|
PhysicalTableMap={
|
|
|
|
"table1": {
|
|
|
|
"RelationalTable": {
|
|
|
|
"DataSourceArn": "d:s:arn",
|
|
|
|
"Catalog": "cat",
|
|
|
|
"Name": "dog",
|
|
|
|
"InputColumns": [{"Name": "c1", "Type": "string"}],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
resp = client.create_ingestion(
|
|
|
|
AwsAccountId=ACCOUNT_ID,
|
|
|
|
DataSetId="n_a",
|
|
|
|
IngestionId="n_a2",
|
|
|
|
IngestionType="FULL_REFRESH",
|
|
|
|
)
|
|
|
|
|
2023-08-17 07:28:50 +00:00
|
|
|
assert resp["Arn"] == (
|
2022-03-31 12:26:17 +00:00
|
|
|
f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/n_a/ingestions/n_a2"
|
|
|
|
)
|
2023-08-17 07:28:50 +00:00
|
|
|
assert resp["IngestionId"] == "n_a2"
|
|
|
|
assert resp["IngestionStatus"] == "INITIALIZED"
|