mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 12:08:40 +02:00
Fix two tests
This commit is contained in:
parent
cbec3f2ed7
commit
5c07775277
3 changed files with 28 additions and 16 deletions
|
@ -1459,9 +1459,15 @@ class TestUser(TestCase):
|
|||
portfolio_permission.portfolio = None
|
||||
portfolio_permission.roles = [UserPortfolioRoleChoices.ORGANIZATION_ADMIN]
|
||||
|
||||
# Create a new UserPortfolioPermission instance without a portfolio
|
||||
invalid_permission = UserPortfolioPermission(
|
||||
user=self.user,
|
||||
roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN],
|
||||
portfolio=None # This should trigger the validation error
|
||||
)
|
||||
# Test if the ValidationError is raised with the correct message
|
||||
with self.assertRaises(ValidationError) as cm:
|
||||
portfolio_permission.clean()
|
||||
invalid_permission.clean()
|
||||
|
||||
self.assertEqual(
|
||||
cm.exception.message, "When portfolio roles or additional permissions are assigned, portfolio is required."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue