| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | import boto3 | 
					
						
							| 
									
										
										
										
											2023-11-30 07:55:51 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 12:03:33 +00:00
										 |  |  | from moto import mock_aws | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 12:03:33 +00:00
										 |  |  | @mock_aws | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | def test_describe(): | 
					
						
							|  |  |  |     client = boto3.client("neptune", "us-east-2") | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert client.describe_global_clusters()["GlobalClusters"] == [] | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 12:03:33 +00:00
										 |  |  | @mock_aws | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | def test_create_global_cluster(): | 
					
						
							|  |  |  |     client = boto3.client("neptune", "us-east-1") | 
					
						
							| 
									
										
										
										
											2023-04-08 10:33:09 +00:00
										 |  |  |     resp = client.create_global_cluster( | 
					
						
							|  |  |  |         GlobalClusterIdentifier="g-id", Engine="neptune" | 
					
						
							|  |  |  |     )["GlobalCluster"] | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert resp["GlobalClusterIdentifier"] == "g-id" | 
					
						
							|  |  |  |     assert "GlobalClusterResourceId" in resp | 
					
						
							|  |  |  |     assert "GlobalClusterArn" in resp | 
					
						
							|  |  |  |     assert resp["Engine"] == "neptune" | 
					
						
							|  |  |  |     assert resp["EngineVersion"] == "1.2.0.0" | 
					
						
							|  |  |  |     assert resp["StorageEncrypted"] is False | 
					
						
							|  |  |  |     assert resp["DeletionProtection"] is False | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert len(client.describe_global_clusters()["GlobalClusters"]) == 1 | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # As a global cluster, verify it can be retrieved everywhere | 
					
						
							|  |  |  |     europe_client = boto3.client("neptune", "eu-north-1") | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert len(europe_client.describe_global_clusters()["GlobalClusters"]) == 1 | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 12:03:33 +00:00
										 |  |  | @mock_aws | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | def test_create_global_cluster_with_additional_params(): | 
					
						
							|  |  |  |     client = boto3.client("neptune", "us-east-1") | 
					
						
							|  |  |  |     resp = client.create_global_cluster( | 
					
						
							|  |  |  |         GlobalClusterIdentifier="g-id", | 
					
						
							| 
									
										
										
										
											2023-04-08 10:33:09 +00:00
										 |  |  |         Engine="neptune", | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  |         EngineVersion="1.0", | 
					
						
							|  |  |  |         DeletionProtection=True, | 
					
						
							|  |  |  |         StorageEncrypted=True, | 
					
						
							|  |  |  |     )["GlobalCluster"] | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert resp["Engine"] == "neptune" | 
					
						
							|  |  |  |     assert resp["EngineVersion"] == "1.0" | 
					
						
							|  |  |  |     assert resp["StorageEncrypted"] is True | 
					
						
							|  |  |  |     assert resp["DeletionProtection"] is True | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-07 12:03:33 +00:00
										 |  |  | @mock_aws | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | def test_delete_global_cluster(): | 
					
						
							| 
									
										
										
										
											2023-04-08 10:33:09 +00:00
										 |  |  |     client = boto3.client("neptune", "us-east-2") | 
					
						
							|  |  |  |     client.create_global_cluster(GlobalClusterIdentifier="g-id2", Engine="neptune") | 
					
						
							| 
									
										
										
										
											2023-02-26 15:27:08 -01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     client.delete_global_cluster(GlobalClusterIdentifier="g-id2") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-15 08:00:12 +00:00
										 |  |  |     assert client.describe_global_clusters()["GlobalClusters"] == [] |