mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
lint and fix tests
This commit is contained in:
parent
88e8b2dbeb
commit
f4c48b55b4
3 changed files with 7 additions and 15 deletions
|
@ -445,7 +445,7 @@ class PortfolioNewMemberForm(BasePortfolioMemberForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PortfolioInvitation
|
model = PortfolioInvitation
|
||||||
fields = ["portfolio", "email", "roles", "additional_permissions"]
|
fields = ["portfolio", "email", "roles", "additional_permissions"]
|
||||||
|
|
||||||
def _post_clean(self):
|
def _post_clean(self):
|
||||||
"""
|
"""
|
||||||
Override _post_clean to customize model validation errors.
|
Override _post_clean to customize model validation errors.
|
||||||
|
|
|
@ -286,7 +286,7 @@ def validate_user_portfolio_permission(user_portfolio_permission):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"This user is already assigned to a portfolio. "
|
"This user is already assigned to a portfolio. "
|
||||||
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
||||||
code="has_existing_permissions"
|
code="has_existing_permissions",
|
||||||
)
|
)
|
||||||
|
|
||||||
existing_invitations = PortfolioInvitation.objects.filter(email=user_portfolio_permission.user.email).exclude(
|
existing_invitations = PortfolioInvitation.objects.filter(email=user_portfolio_permission.user.email).exclude(
|
||||||
|
@ -297,7 +297,7 @@ def validate_user_portfolio_permission(user_portfolio_permission):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"This user is already assigned to a portfolio invitation. "
|
"This user is already assigned to a portfolio invitation. "
|
||||||
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
||||||
code="has_existing_invitations"
|
code="has_existing_invitations",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,14 +359,14 @@ def validate_portfolio_invitation(portfolio_invitation):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"This user is already assigned to a portfolio. "
|
"This user is already assigned to a portfolio. "
|
||||||
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
||||||
code="has_existing_permissions"
|
code="has_existing_permissions",
|
||||||
)
|
)
|
||||||
|
|
||||||
if existing_invitations.exists():
|
if existing_invitations.exists():
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"This user is already assigned to a portfolio invitation. "
|
"This user is already assigned to a portfolio invitation. "
|
||||||
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
"Based on current waffle flag settings, users cannot be assigned to multiple portfolios.",
|
||||||
code="has_existing_invitations"
|
code="has_existing_invitations",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3873,11 +3873,7 @@ class TestPortfolioInviteNewMemberView(MockEppLib, WebTest):
|
||||||
# verify messages
|
# verify messages
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
(
|
("This user has already been invited to another .gov organization."),
|
||||||
"This user is already assigned to a portfolio invitation. "
|
|
||||||
"Based on current waffle flag settings, users cannot be assigned "
|
|
||||||
"to multiple portfolios."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Validate Database has not changed
|
# Validate Database has not changed
|
||||||
|
@ -3915,11 +3911,7 @@ class TestPortfolioInviteNewMemberView(MockEppLib, WebTest):
|
||||||
# Verify messages
|
# Verify messages
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
(
|
("This user is already a member of another .gov organization."),
|
||||||
"This user is already assigned to a portfolio. "
|
|
||||||
"Based on current waffle flag settings, users cannot be "
|
|
||||||
"assigned to multiple portfolios."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Validate Database has not changed
|
# Validate Database has not changed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue