Skip to content

Commit

Permalink
Enable RBAC for rbac schema tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop committed Jan 7, 2025
1 parent 9899dbb commit ce49b5b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/schemas/rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from core.schemas import entity, graph, observable, rbac, user


class TagTest(unittest.TestCase):
class RBACTest(unittest.TestCase):
def setUp(self) -> None:
database_arango.db.connect(database="yeti")
database_arango.db.connect(database="yeti_test")
database_arango.db.truncate()
rbac.RBAC_ENABLED = True

self.yeti_user = user.User(username="yeti", admin=True).save()
self.user1 = user.User(username="test1").save()
self.user2 = user.User(username="test2").save()
Expand All @@ -18,6 +20,9 @@ def setUp(self) -> None:
self.observable1 = observable.Hostname(value="test.com").save()
self.observable1.link_to(self.entity1, "test", description="test")

def tearDown(self) -> None:
rbac.RBAC_ENABLED = False

def test_user_group_role_association(self) -> None:
"""Test that a role can be created"""
role = self.user1.link_to_acl(self.group1, graph.Role.OWNER)
Expand Down

0 comments on commit ce49b5b

Please sign in to comment.