Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
markkuleinio committed Aug 26, 2023
1 parent c1f3405 commit 48d789b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/fixtures/users/permission.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
{
"username": "user1"
}
],
"constraints": [
{
"status": "active"
},
{
"region__name": "Europe"
}
]
}
8 changes: 8 additions & 0 deletions tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ def test_username(self, _):
user = permission.users[0]
self.assertEqual(str(user), "user1")

@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="users/permission.json"),
)
def test_constraints(self, _):
permission = nb.permissions.get(1)
self.assertTrue(isinstance(permission.constraints[0], dict))


class UnknownModelTestCase(unittest.TestCase):
"""This test validates that an unknown model is returned as Record object
Expand Down

0 comments on commit 48d789b

Please sign in to comment.