Skip to content

Commit 1820346

Browse files
committed
Linter fixes
1 parent a598817 commit 1820346

File tree

2 files changed

+55
-29
lines changed

2 files changed

+55
-29
lines changed

test/integration/conftest.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,14 @@ def create_vpc(test_linode_client):
457457
vpc = client.vpcs.create(
458458
label=label,
459459
region=get_region(
460-
test_linode_client, {"VPCs", "VPC IPv6 Stack", "VPC Dual Stack", "Linode Interfaces", "NodeBalancers"}
460+
test_linode_client,
461+
{
462+
"VPCs",
463+
"VPC IPv6 Stack",
464+
"VPC Dual Stack",
465+
"Linode Interfaces",
466+
"NodeBalancers",
467+
},
461468
),
462469
description="test description",
463470
ipv6=[{"range": "auto"}],
@@ -478,7 +485,7 @@ def create_vpc_ipv4(test_linode_client):
478485
region=get_region(
479486
test_linode_client, {"VPCs", "Linode Interfaces", "NodeBalancers"}
480487
),
481-
description="test description"
488+
description="test description",
482489
)
483490
yield vpc
484491

@@ -501,8 +508,7 @@ def create_vpc_with_subnet(test_linode_client, create_vpc):
501508
@pytest.fixture(scope="session")
502509
def create_vpc_with_subnet_ipv4(test_linode_client, create_vpc_ipv4):
503510
subnet = create_vpc_ipv4.subnet_create(
504-
label="test-subnet",
505-
ipv4="10.0.0.0/24"
511+
label="test-subnet", ipv4="10.0.0.0/24"
506512
)
507513

508514
yield create_vpc_ipv4, subnet

test/integration/models/nodebalancer/test_nodebalancer.py

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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

375387
def 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

Comments
 (0)