| 
									
										
										
										
											2022-03-31 12:26:17 +00:00
										 |  |  | import boto3 | 
					
						
							|  |  |  | import sure  # noqa # pylint: disable=unused-import | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from moto import mock_quicksight | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @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"}], | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     resp.should.have.key("Arn").equals( | 
					
						
							|  |  |  |         f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/myset" | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     resp.should.have.key("DataSetId").equals("myset") | 
					
						
							|  |  |  |     resp.should.have.key("IngestionArn").equals( | 
					
						
							|  |  |  |         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", | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     resp.should.have.key("Arn").equals( | 
					
						
							|  |  |  |         f"arn:aws:quicksight:eu-west-1:{ACCOUNT_ID}:data-set/n_a/ingestions/n_a2" | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     resp.should.have.key("IngestionId").equals("n_a2") | 
					
						
							|  |  |  |     resp.should.have.key("IngestionStatus").equals("INITIALIZED") |