| 
									
										
										
										
											2022-11-16 18:58:24 -08:00
										 |  |  | from urllib.parse import urlencode | 
					
						
							| 
									
										
										
										
											2015-01-08 22:18:06 -05:00
										 |  |  | import moto.server as server | 
					
						
							| 
									
										
										
										
											2022-03-09 10:05:18 -01:00
										 |  |  | import sure  # noqa # pylint: disable=unused-import | 
					
						
							| 
									
										
										
										
											2015-01-08 22:18:06 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_list_databases(): | 
					
						
							|  |  |  |     backend = server.create_backend_app("rds") | 
					
						
							|  |  |  |     test_client = backend.test_client() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 08:44:26 -07:00
										 |  |  |     res = test_client.get("/?Action=DescribeDBInstances") | 
					
						
							| 
									
										
										
										
											2015-01-08 22:18:06 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     res.data.decode("utf-8").should.contain("<DescribeDBInstancesResult>") | 
					
						
							| 
									
										
										
										
											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-16 18:58:24 -08:00
										 |  |  |     params = { | 
					
						
							|  |  |  |         "Action": "CreateDBInstance", | 
					
						
							| 
									
										
										
										
											2022-05-11 09:15:28 +00:00
										 |  |  |         "DBInstanceIdentifier": "hi", | 
					
						
							|  |  |  |         "DBInstanceClass": "db.m4.large", | 
					
						
							|  |  |  |         "Engine": "aurora", | 
					
						
							|  |  |  |         "StorageType": "standard", | 
					
						
							|  |  |  |         "Port": 3306, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-11-16 18:58:24 -08:00
										 |  |  |     qs = urlencode(params) | 
					
						
							|  |  |  |     resp = test_client.post(f"/?{qs}") | 
					
						
							| 
									
										
										
										
											2022-05-11 09:15:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-16 18:58:24 -08:00
										 |  |  |     response = resp.data.decode("utf-8") | 
					
						
							| 
									
										
										
										
											2022-05-25 09:21:03 +00:00
										 |  |  |     response.shouldnt.contain("<DBClusterIdentifier>") | 
					
						
							| 
									
										
										
										
											2022-11-16 18:58:24 -08:00
										 |  |  |     response.should.contain("<DBInstanceIdentifier>hi</DBInstanceIdentifier") | 
					
						
							| 
									
										
										
										
											2022-05-25 09:21:03 +00:00
										 |  |  |     # We do not pass these values - they should default to false | 
					
						
							|  |  |  |     response.should.contain("<MultiAZ>false</MultiAZ>") | 
					
						
							|  |  |  |     response.should.contain( | 
					
						
							|  |  |  |         "<IAMDatabaseAuthenticationEnabled>false</IAMDatabaseAuthenticationEnabled>" | 
					
						
							|  |  |  |     ) |