From c97d4ce02dfa1bdf2b7d52915641c88080dcd4c2 Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Thu, 13 Jun 2024 06:44:40 -0400 Subject: [PATCH] Roles Equals func --- brewtils/models.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/brewtils/models.py b/brewtils/models.py index ad42ccc7..be5216b3 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -1710,6 +1710,22 @@ def __repr__(self): self.scope_commands, ) + def __eq__(self, other): + if not isinstance(other, Role): + # don't attempt to compare against unrelated types + return NotImplemented + + return ( + self.name == other.name + and self.description == other.description + and self.scope_gardens == other.scope_gardens + and self.scope_namespaces == other.scope_namespaces + and self.scope_systems == other.scope_systems + and self.scope_instances == other.scope_instances + and self.scope_versions == other.scope_versions + and self.scope_commands == other.scope_commands + ) + class UpstreamRole(Role): schema = "UpstreamRoleSchema"