Skip to content

Commit 636eabb

Browse files
committed
linter fixes
1 parent feef44e commit 636eabb

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

unittests/test_cicd_infrastructure.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""Tests for the CICDInfrastructure model, form, and API.
1+
"""
2+
Tests for the CICDInfrastructure model, form, and API.
23
34
Migration behaviour is tested separately in
45
``test_cicd_infrastructure_migration.py``.
@@ -12,31 +13,33 @@
1213
from dojo.forms import CICDInfrastructureForm
1314
from dojo.models import CICDInfrastructure
1415

15-
1616
# ---------------------------------------------------------------------------
1717
# Model
1818
# ---------------------------------------------------------------------------
1919

20+
2021
class CICDInfrastructureModelTests(APITestCase):
22+
2123
"""Model-level constraints and defaults."""
2224

2325
def test_unique_together_within_same_type_rejects_duplicate(self):
2426
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="build_server")
25-
with self.assertRaises(IntegrityError):
26-
with transaction.atomic():
27-
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="build_server")
27+
with self.assertRaises(IntegrityError), transaction.atomic():
28+
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="build_server")
2829

2930
def test_same_name_across_different_types_allowed(self):
30-
"""unique_together is (name, infrastructure_type), so the same name across
31+
"""
32+
unique_together is (name, infrastructure_type), so the same name across
3133
different types coexists — supports the 'one Jenkins instance, multiple
32-
roles' case."""
34+
roles' case.
35+
"""
3336
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="build_server")
3437
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="scm_server")
3538
CICDInfrastructure.objects.create(name="Jenkins", infrastructure_type="orchestration")
3639
self.assertEqual(CICDInfrastructure.objects.filter(name="Jenkins").count(), 3)
3740

3841
def test_description_and_url_default_to_empty_string(self):
39-
"""description and url are non-null with default='' (no None values)."""
42+
"""Description and url are non-null with default='' (no None values)."""
4043
infra = CICDInfrastructure.objects.create(name="Bare", infrastructure_type="build_server")
4144
self.assertEqual(infra.description, "")
4245
self.assertEqual(infra.url, "")
@@ -47,6 +50,7 @@ def test_description_and_url_default_to_empty_string(self):
4750
# ---------------------------------------------------------------------------
4851

4952
class CICDInfrastructureFormTests(APITestCase):
53+
5054
"""Form-level behaviour — specifically the type-locked-on-edit rule."""
5155

5256
def test_infrastructure_type_editable_on_create(self):
@@ -61,9 +65,11 @@ def test_infrastructure_type_disabled_on_edit(self):
6165
self.assertTrue(form.fields["infrastructure_type"].disabled)
6266

6367
def test_disabled_field_ignores_posted_value(self):
64-
"""Django enforces ``disabled=True`` server-side — POSTed values
68+
"""
69+
Django enforces ``disabled=True`` server-side — POSTed values
6570
for the type field on edit are silently ignored, so users cannot
66-
sneak around the UI lock."""
71+
sneak around the UI lock.
72+
"""
6773
existing = CICDInfrastructure.objects.create(
6874
name="LockedType2", infrastructure_type="build_server",
6975
)
@@ -86,8 +92,11 @@ def test_disabled_field_ignores_posted_value(self):
8692
# ---------------------------------------------------------------------------
8793

8894
class CICDInfrastructureAPITests(APITestCase):
89-
"""The /cicd_infrastructure endpoint uses UserHasConfigurationPermissionSuperuser
90-
— superusers can do anything; non-superusers need the explicit Django permission."""
95+
96+
"""
97+
The /cicd_infrastructure endpoint uses UserHasConfigurationPermissionSuperuser
98+
— superusers can do anything; non-superusers need the explicit Django permission.
99+
"""
91100

92101
fixtures = ["dojo_testdata.json"]
93102

0 commit comments

Comments
 (0)