@@ -283,23 +283,27 @@ def test_nb_with_backend_only(test_linode_client, create_vpc_with_subnet):
283283 label = get_test_label (8 )
284284
285285 nb = client .nodebalancer_create (
286- region = vpc_region , label = label , vpcs = [{"vpc_id" : vpc ,"subnet_id" : subnet }]
286+ region = vpc_region ,
287+ label = label ,
288+ vpcs = [{"vpc_id" : vpc , "subnet_id" : subnet }],
287289 )
288290
289- assert isinstance (ipaddress .ip_address (nb .ipv4 .address ), ipaddress .IPv4Address )
291+ assert isinstance (
292+ ipaddress .ip_address (nb .ipv4 .address ), ipaddress .IPv4Address
293+ )
290294 assert isinstance (ipaddress .ip_address (nb .ipv6 ), ipaddress .IPv6Address )
291- assert nb .frontend_address_type == ' public'
295+ assert nb .frontend_address_type == " public"
292296 assert nb .frontend_vpc_subnet_id is None
293297
294298 nb_get = NodeBalancer (client , nb .id )
295299 nb_vpcs = nb_get .vpcs ()
296300
297301 assert len (nb_vpcs ) == 1
298- assert nb_vpcs [0 ].purpose == ' backend'
302+ assert nb_vpcs [0 ].purpose == " backend"
299303
300304 nb_vpc = nb_get .vpc (nb_vpcs [0 ].id )
301305
302- assert nb_vpc .purpose == ' backend'
306+ assert nb_vpc .purpose == " backend"
303307
304308 # TODO: Uncomment when API implementation of /backend_vpcs and /frontend_vpcs endpoints is finished
305309 # nb_backend_vpcs = nb_get.backend_vpcs()
@@ -312,22 +316,24 @@ def test_nb_with_backend_only(test_linode_client, create_vpc_with_subnet):
312316 nb .delete ()
313317
314318
315- def test_nb_with_frontend_ipv4_only_in_single_stack_vpc (test_linode_client , create_vpc_with_subnet_ipv4 ):
319+ def test_nb_with_frontend_ipv4_only_in_single_stack_vpc (
320+ test_linode_client , create_vpc_with_subnet_ipv4
321+ ):
316322 client = test_linode_client
317323 vpc_region = create_vpc_with_subnet_ipv4 [0 ].region
318324 subnet = create_vpc_with_subnet_ipv4 [1 ].id
319325 label = get_test_label (8 )
320- ipv4_address = "10.0.0.2" # first available address
326+ ipv4_address = "10.0.0.2" # first available address
321327
322328 nb = client .nodebalancer_create (
323329 region = vpc_region ,
324330 label = label ,
325331 frontend_vpcs = [{"subnet_id" : subnet , "ipv4_range" : "10.0.0.0/24" }],
326- type = "premium"
332+ type = "premium" ,
327333 )
328334 assert nb .ipv4 .address == ipv4_address
329335 assert nb .ipv6 is None
330- assert nb .frontend_address_type == ' vpc'
336+ assert nb .frontend_address_type == " vpc"
331337 assert nb .frontend_vpc_subnet_id == subnet
332338
333339 # TODO: Uncomment when API implementation of /backend_vpcs and /frontend_vpcs endpoints is finished
@@ -341,7 +347,9 @@ def test_nb_with_frontend_ipv4_only_in_single_stack_vpc(test_linode_client, crea
341347 nb .delete ()
342348
343349
344- def test_nb_with_frontend_ipv6_only_in_single_stack_vpc (test_linode_client , create_vpc_with_subnet_ipv4 ):
350+ def test_nb_with_frontend_ipv6_only_in_single_stack_vpc (
351+ test_linode_client , create_vpc_with_subnet_ipv4
352+ ):
345353 client = test_linode_client
346354 vpc_region = create_vpc_with_subnet_ipv4 [0 ].region
347355 subnet = create_vpc_with_subnet_ipv4 [1 ].id
@@ -352,12 +360,14 @@ def test_nb_with_frontend_ipv6_only_in_single_stack_vpc(test_linode_client, crea
352360 region = vpc_region ,
353361 label = label ,
354362 frontend_vpcs = [{"subnet_id" : subnet , "ipv6_range" : "/62" }],
355- type = "premium"
363+ type = "premium" ,
356364 )
357365 assert "No IPv6 subnets available in VPC" in str (err .json )
358366
359367
360- def test_nb_with_frontend_and_default_type (test_linode_client , create_vpc_with_subnet ):
368+ def test_nb_with_frontend_and_default_type (
369+ test_linode_client , create_vpc_with_subnet
370+ ):
361371 client = test_linode_client
362372 vpc_region = create_vpc_with_subnet [0 ].region
363373 subnet = create_vpc_with_subnet [1 ].id
@@ -369,7 +379,9 @@ def test_nb_with_frontend_and_default_type(test_linode_client, create_vpc_with_s
369379 label = label ,
370380 frontend_vpcs = [{"subnet_id" : subnet }],
371381 )
372- assert "Nodebalancer with frontend VPC IP must be premium" in str (err .json )
382+ assert "Nodebalancer with frontend VPC IP must be premium" in str (
383+ err .json
384+ )
373385
374386
375387def test_nb_with_frontend_and_premium40gb_type (test_linode_client ):
@@ -393,28 +405,30 @@ def test_nb_with_frontend_and_premium40gb_type(test_linode_client):
393405 region = region ,
394406 label = get_test_label (length = 8 ),
395407 frontend_vpcs = [{"subnet_id" : subnet .id }],
396- type = "premium_40gb"
408+ type = "premium_40gb" ,
397409 )
398- assert nb .type == ' premium_40gb'
410+ assert nb .type == " premium_40gb"
399411
400412 nb_get = test_linode_client .load (
401413 NodeBalancer ,
402414 nb .id ,
403415 )
404- assert nb_get .type == ' premium_40gb'
416+ assert nb_get .type == " premium_40gb"
405417
406418 nb .delete ()
407419 vpc .delete ()
408420
409421
410- def test_nb_with_frontend_and_backend_in_different_vpcs (test_linode_client , create_vpc_with_subnet ):
422+ def test_nb_with_frontend_and_backend_in_different_vpcs (
423+ test_linode_client , create_vpc_with_subnet
424+ ):
411425 client = test_linode_client
412426 region = create_vpc_with_subnet [0 ].region
413427 vpc_backend = create_vpc_with_subnet [0 ].id
414428 subnet_backend = create_vpc_with_subnet [1 ].id
415429 label = get_test_label (8 )
416430 ipv4_range = "10.0.0.0/24"
417- ipv4_address = "10.0.0.2" # first available address
431+ ipv4_address = "10.0.0.2" # first available address
418432
419433 vpc_frontend = client .vpcs .create (
420434 label = get_test_label (length = 10 ),
@@ -434,14 +448,20 @@ def test_nb_with_frontend_and_backend_in_different_vpcs(test_linode_client, crea
434448 nb = client .nodebalancer_create (
435449 region = region ,
436450 label = label ,
437- vpcs = [{"vpc_id" : vpc_backend ,"subnet_id" : subnet_backend }],
438- frontend_vpcs = [{"subnet_id" : subnet_frontend .id , "ipv4_range" : ipv4_range , "ipv6_range" : ipv6_range }],
439- type = "premium"
451+ vpcs = [{"vpc_id" : vpc_backend , "subnet_id" : subnet_backend }],
452+ frontend_vpcs = [
453+ {
454+ "subnet_id" : subnet_frontend .id ,
455+ "ipv4_range" : ipv4_range ,
456+ "ipv6_range" : ipv6_range ,
457+ }
458+ ],
459+ type = "premium" ,
440460 )
441461
442462 assert nb .ipv4 .address == ipv4_address
443463 assert nb .ipv6 == ipv6_address
444- assert nb .frontend_address_type == ' vpc'
464+ assert nb .frontend_address_type == " vpc"
445465 assert nb .frontend_vpc_subnet_id == subnet_frontend .id
446466
447467 nb_get = NodeBalancer (client , nb .id )
@@ -450,8 +470,8 @@ def test_nb_with_frontend_and_backend_in_different_vpcs(test_linode_client, crea
450470 assert len (nb_vpcs ) == 2
451471 assert nb_vpcs [0 ].ipv4_range == f"{ ipv4_address } /32"
452472 assert nb_vpcs [0 ].ipv6_range == f"{ ipv6_address [:- 1 ]} /64"
453- assert nb_vpcs [0 ].purpose == ' frontend'
454- assert nb_vpcs [1 ].purpose == ' backend'
473+ assert nb_vpcs [0 ].purpose == " frontend"
474+ assert nb_vpcs [1 ].purpose == " backend"
455475
456476 # TODO: Uncomment when API implementation of /backend_vpcs and /frontend_vpcs endpoints is finished
457477 # nb_backend_vpcs = nb_get.backend_vpcs()
@@ -463,4 +483,4 @@ def test_nb_with_frontend_and_backend_in_different_vpcs(test_linode_client, crea
463483 # assert nb_frontend_vpcs[0].purpose == 'frontend'
464484
465485 nb .delete ()
466- vpc_frontend .delete ()
486+ vpc_frontend .delete ()
0 commit comments