mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-02 01:03:28 +02:00
Lint fixes
This commit is contained in:
parent
36eb7064c2
commit
99425ebc4f
4 changed files with 16 additions and 9 deletions
|
@ -2,6 +2,7 @@ from django.db import models
|
|||
|
||||
from .utility.time_stamped_model import TimeStampedModel
|
||||
|
||||
|
||||
class UserDomainRole(TimeStampedModel):
|
||||
|
||||
"""This is a linking table that connects a user with a role on a domain."""
|
||||
|
@ -19,7 +20,7 @@ class UserDomainRole(TimeStampedModel):
|
|||
user = models.ForeignKey(
|
||||
"registrar.User",
|
||||
null=False,
|
||||
on_delete=models.CASCADE, # when a user is deleted, their permissions will be too
|
||||
on_delete=models.CASCADE, # when a user is deleted, permissions are too
|
||||
related_name="permissions",
|
||||
)
|
||||
|
||||
|
@ -27,7 +28,7 @@ class UserDomainRole(TimeStampedModel):
|
|||
"registrar.Domain",
|
||||
null=False,
|
||||
on_delete=models.CASCADE, # when a domain is deleted, permissions are too
|
||||
related_name="permissions"
|
||||
related_name="permissions",
|
||||
)
|
||||
|
||||
role = models.TextField(
|
||||
|
@ -44,6 +45,6 @@ class UserDomainRole(TimeStampedModel):
|
|||
# a user can have only one role on a given domain, that is, there can
|
||||
# be only a single row with a certain (user, domain) pair.
|
||||
models.UniqueConstraint(
|
||||
fields=['user', 'domain'], name='unique_user_domain_role'
|
||||
fields=["user", "domain"], name="unique_user_domain_role"
|
||||
)
|
||||
]
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
from django.test import TestCase
|
||||
from django.db.utils import IntegrityError
|
||||
|
||||
from registrar.models import Contact, DomainApplication, User, Website, Domain, UserDomainRole
|
||||
from registrar.models import (
|
||||
Contact,
|
||||
DomainApplication,
|
||||
User,
|
||||
Website,
|
||||
Domain,
|
||||
UserDomainRole,
|
||||
)
|
||||
from unittest import skip
|
||||
|
||||
import boto3_mocking # type: ignore
|
||||
|
@ -146,8 +153,9 @@ class TestPermissions(TestCase):
|
|||
def test_approval_creates_role(self):
|
||||
domain, _ = Domain.objects.get_or_create(name="igorville.gov")
|
||||
user, _ = User.objects.get_or_create()
|
||||
application = DomainApplication.objects.create(creator=user,
|
||||
requested_domain=domain)
|
||||
application = DomainApplication.objects.create(
|
||||
creator=user, requested_domain=domain
|
||||
)
|
||||
# skip using the submit method
|
||||
application.status = DomainApplication.SUBMITTED
|
||||
application.approve()
|
||||
|
@ -156,7 +164,6 @@ class TestPermissions(TestCase):
|
|||
self.assertTrue(UserDomainRole.objects.get(user=user, domain=domain))
|
||||
|
||||
|
||||
|
||||
@skip("Not implemented yet.")
|
||||
class TestDomainApplicationLifeCycle(TestCase):
|
||||
def test_application_approval(self):
|
||||
|
|
|
@ -1116,7 +1116,6 @@ class TestDomainPermissions(TestWithUser):
|
|||
|
||||
|
||||
class TestDomainDetail(TestDomainPermissions, WebTest):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.app.set_user(self.user.username)
|
||||
|
|
|
@ -29,7 +29,7 @@ class DomainPermission(PermissionsLoginMixin):
|
|||
|
||||
# user needs to have a role on the domain
|
||||
try:
|
||||
role = UserDomainRole.objects.get(
|
||||
UserDomainRole.objects.get(
|
||||
user=self.request.user, domain__id=self.kwargs["pk"]
|
||||
)
|
||||
except UserDomainRole.DoesNotExist:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue