22from test .unit .base import ClientBaseCase
33
44from linode_api4 import (
5+ DatabasePrivateNetwork ,
56 MySQLDatabaseConfigMySQLOptions ,
67 MySQLDatabaseConfigOptions ,
78 PostgreSQLDatabase ,
@@ -41,6 +42,11 @@ def test_create(self):
4142 ),
4243 binlog_retention_period = 200 ,
4344 ),
45+ private_network = DatabasePrivateNetwork (
46+ vpc_id = 1234 ,
47+ subnet_id = 5678 ,
48+ public_access = True ,
49+ ),
4450 )
4551 except Exception as e :
4652 logger .warning (
@@ -61,6 +67,12 @@ def test_create(self):
6167 m .call_data ["engine_config" ]["binlog_retention_period" ], 200
6268 )
6369
70+ self .assertEqual (m .call_data ["private_network" ]["vpc_id" ], 1234 )
71+ self .assertEqual (m .call_data ["private_network" ]["subnet_id" ], 5678 )
72+ self .assertEqual (
73+ m .call_data ["private_network" ]["public_access" ], True
74+ )
75+
6476 def test_update (self ):
6577 """
6678 Test that the MySQL database can be updated
@@ -78,6 +90,11 @@ def test_update(self):
7890 mysql = MySQLDatabaseConfigMySQLOptions (connect_timeout = 20 ),
7991 binlog_retention_period = 200 ,
8092 )
93+ db .private_network = DatabasePrivateNetwork (
94+ vpc_id = 1234 ,
95+ subnet_id = 5678 ,
96+ public_access = True ,
97+ )
8198
8299 db .save ()
83100
@@ -93,6 +110,12 @@ def test_update(self):
93110 m .call_data ["engine_config" ]["binlog_retention_period" ], 200
94111 )
95112
113+ self .assertEqual (m .call_data ["private_network" ]["vpc_id" ], 1234 )
114+ self .assertEqual (m .call_data ["private_network" ]["subnet_id" ], 5678 )
115+ self .assertEqual (
116+ m .call_data ["private_network" ]["public_access" ], True
117+ )
118+
96119 def test_list_backups (self ):
97120 """
98121 Test that MySQL backups list properly
@@ -259,6 +282,11 @@ def test_create(self):
259282 ),
260283 work_mem = 4 ,
261284 ),
285+ private_network = DatabasePrivateNetwork (
286+ vpc_id = 1234 ,
287+ subnet_id = 5678 ,
288+ public_access = True ,
289+ ),
262290 )
263291 except Exception :
264292 pass
@@ -302,6 +330,12 @@ def test_create(self):
302330 )
303331 self .assertEqual (m .call_data ["engine_config" ]["work_mem" ], 4 )
304332
333+ self .assertEqual (m .call_data ["private_network" ]["vpc_id" ], 1234 )
334+ self .assertEqual (m .call_data ["private_network" ]["subnet_id" ], 5678 )
335+ self .assertEqual (
336+ m .call_data ["private_network" ]["public_access" ], True
337+ )
338+
305339 def test_update (self ):
306340 """
307341 Test that the PostgreSQL database can be updated
@@ -322,6 +356,12 @@ def test_update(self):
322356 work_mem = 4 ,
323357 )
324358
359+ db .private_network = DatabasePrivateNetwork (
360+ vpc_id = 1234 ,
361+ subnet_id = 5678 ,
362+ public_access = True ,
363+ )
364+
325365 db .save ()
326366
327367 self .assertEqual (m .method , "put" )
@@ -337,6 +377,12 @@ def test_update(self):
337377 )
338378 self .assertEqual (m .call_data ["engine_config" ]["work_mem" ], 4 )
339379
380+ self .assertEqual (m .call_data ["private_network" ]["vpc_id" ], 1234 )
381+ self .assertEqual (m .call_data ["private_network" ]["subnet_id" ], 5678 )
382+ self .assertEqual (
383+ m .call_data ["private_network" ]["public_access" ], True
384+ )
385+
340386 def test_list_backups (self ):
341387 """
342388 Test that PostgreSQL backups list properly
0 commit comments