Skip to content

Commit

Permalink
fixed testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Mar 12, 2024
1 parent af9e8a6 commit da29301
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,12 +1676,13 @@ def __str__(self):

def __repr__(self):
return (
"<Role: id=%s, name=%s, permission=%s, scope_garden=%s, "
"<Role: id=%s, name=%s, description=%s, permission=%s, scope_garden=%s, "
"scope_namespaces=%s, scope_systems=%s, scope_instances=%s, "
"scope_versions=%s, scope_commands=%s>"
) % (
self.id,
self.name,
self.description,
self.permission,
self.scope_gardens,
self.scope_namespaces,
Expand Down
4 changes: 2 additions & 2 deletions brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,10 @@ class ResolvableSchema(BaseSchema):


class RoleSchema(BaseSchema):
permission = fields.Str()
description = fields.Str(allow_none=True)
id = fields.Str(allow_none=True)
name = fields.Str()
description = fields.Str(allow_none=True)
permission = fields.Str()
scope_gardens = fields.List(fields.Str(), allow_none=True)
scope_namespaces = fields.List(fields.Str(), allow_none=True)
scope_systems = fields.List(fields.Str(), allow_none=True)
Expand Down
1 change: 1 addition & 0 deletions brewtils/test/comparable.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def assert_user_equal(obj1, obj2, do_raise=False):
obj2,
expected_type=User,
deep_fields={
"local_roles": partial(assert_role_equal, do_raise=True),
"remote_roles": partial(assert_role_equal, do_raise=True),
"remote_user_mapping": partial(assert_remote_user_map_equal, do_raise=True),
},
Expand Down
4 changes: 2 additions & 2 deletions test/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,14 @@ def test_repr(self, user):
class TestRole(object):
@pytest.fixture
def role(self):
return Role(name="bg-admin", permission="ADMIN")
return Role(name="bg-admin", permission="PLUGIN_ADMIN")

def test_str(self, role):
assert str(role) == "bg-admin"

def test_repr(self, role):
assert repr(role) == (
"<Role: id=None, name=bg-admin, permission=ADMIN, "
"<Role: id=None, name=bg-admin, description=None, permission=PLUGIN_ADMIN, "
"scope_garden=[], scope_namespaces=[], scope_systems=[], "
"scope_instances=[], scope_versions=[], scope_commands=[]>"
)
Expand Down

0 comments on commit da29301

Please sign in to comment.