moto/tests/test_quicksight/test_quicksight_datasets.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.0 KiB
Python
Raw Normal View History

import boto3
from moto import mock_quicksight
2022-08-13 09:49:43 +00:00
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
# 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
@mock_quicksight
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"}],
}
}
},
)
assert resp["Arn"] == (f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/myset")
assert resp["DataSetId"] == "myset"
assert resp["IngestionArn"] == (
f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:ingestion/tbd"
)
@mock_quicksight
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",
)
assert resp["Arn"] == (
f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/n_a/ingestions/n_a2"
)
assert resp["IngestionId"] == "n_a2"
assert resp["IngestionStatus"] == "INITIALIZED"