prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add tests for domain's RoleManager
  ## Description
  Add unit tests for grid domain's RoleManager at the module `grid/apps/domain/src/main/core/manager`
  
  ## Type of Test
  - [x] **Unit test** (e.g. checking a loop, method, or function is working as intended)
  - [ ] **Integration test** (e.g. checking if a certain group or set of functionality is working as intended)
  - [ ] **Regression test** (e.g. checking if by adding or removing a module of code allows other systems to continue to function as intended)
  - [ ] **Stress test** (e.g. checking to see how well a system performs under various situations, including heavy usage)
  - [ ] **Performance test** (e.g. checking to see how efficient a system is as performing the intended task)
  - [ ] Other...
  
  ## Expected Behavior
  Ideally, the tests should cover as many methods as possible and within reason.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `packages/grid/apps/domain/src/main/core/manager/role_manager.py`
  Content:
  ```
  1 # stdlib
  2 from typing import List
  3 from typing import Union
  4 
  5 # grid relative
  6 from ..database.tables.roles import Role
  7 from ..exceptions import RoleNotFoundError
  8 from .database_manager import DatabaseManager
  9 
  10 
  11 class RoleManager(DatabaseManager):
  12 
  13     schema = Role
  14 
  15     def __init__(self, database):
  16         self._schema = RoleManager.schema
  17         self.db = database
  18 
  19     @property
  20     def user_role(self):
  21         return self.first(name="User")
  22 
  23     @property
  24     def owner_role(self):
  25         return self.first(name="Owner")
  26 
  27     @property
  28     def compliance_officer_role(self):
  29         return self.first(name="Compliance Officer")
  30 
  31     @property
  32     def admin_role(self):
  33         return self.first(name="Administrator")
  34 
  35     @property
  36     def common_roles(self):
  37         return self.db.session.query(self._schema).filter_by(
  38             can_triage_requests=False,
  39             can_edit_settings=False,
  40             can_create_users=False,
  41             can_create_groups=False,
  42             can_upload_data=False,
  43             can_edit_roles=False,
  44             can_manage_infrastructure=False,
  45         )
  46 
  47     @property
  48     def org_roles(self):
  49         return self.db.session.query(self._schema).except_(self.common_roles)
  50 
  51     def first(self, **kwargs) -> Union[None, List]:
  52         result = super().first(**kwargs)
  53         if not result:
  54             raise RoleNotFoundError
  55         return result
  56 
  57     def query(self, **kwargs) -> Union[None, List]:
  58         results = super().query(**kwargs)
  59         if len(results) == 0:
  60             raise RoleNotFoundError
  61         return results
  62 
  63     def set(self, role_id, params):
  64         if self.contain(id=role_id):
  65             self.modify({"id": role_id}, params)
  66         else:
  67             raise RoleNotFoundError
  68
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/packages/grid/apps/domain/src/main/core/manager/role_manager.py b/packages/grid/apps/domain/src/main/core/manager/role_manager.py
  --- a/packages/grid/apps/domain/src/main/core/manager/role_manager.py
  +++ b/packages/grid/apps/domain/src/main/core/manager/role_manager.py
  @@ -2,6 +2,8 @@
   from typing import List
   from typing import Union
   
  +from flask_sqlalchemy import BaseQuery
  +
   # grid relative
   from ..database.tables.roles import Role
   from ..exceptions import RoleNotFoundError
  @@ -32,8 +34,7 @@
       def admin_role(self):
           return self.first(name="Administrator")
   
  -    @property
  -    def common_roles(self):
  +    def _common_roles(self) -> BaseQuery:
           return self.db.session.query(self._schema).filter_by(
               can_triage_requests=False,
               can_edit_settings=False,
  @@ -44,9 +45,13 @@
               can_manage_infrastructure=False,
           )
   
  +    @property
  +    def common_roles(self):
  +        return self._common_roles().all()
  +
       @property
       def org_roles(self):
  -        return self.db.session.query(self._schema).except_(self.common_roles)
  +        return self.db.session.query(self._schema).except_(self._common_roles).all()
   
       def first(self, **kwargs) -> Union[None, List]:
           result = super().first(**kwargs)
  
verification_info: {"golden_diff": "diff --git a/packages/grid/apps/domain/src/main/core/manager/role_manager.py b/packages/grid/apps/domain/src/main/core/manager/role_manager.py\n--- a/packages/grid/apps/domain/src/main/core/manager/role_manager.py\n+++ b/packages/grid/apps/domain/src/main/core/manager/role_manager.py\n@@ -2,6 +2,8 @@\n from typing import List\n from typing import Union\n \n+from flask_sqlalchemy import BaseQuery\n+\n # grid relative\n from ..database.tables.roles import Role\n from ..exceptions import RoleNotFoundError\n@@ -32,8 +34,7 @@\n     def admin_role(self):\n         return self.first(name=\"Administrator\")\n \n-    @property\n-    def common_roles(self):\n+    def _common_roles(self) -> BaseQuery:\n         return self.db.session.query(self._schema).filter_by(\n             can_triage_requests=False,\n             can_edit_settings=False,\n@@ -44,9 +45,13 @@\n             can_manage_infrastructure=False,\n         )\n \n+    @property\n+    def common_roles(self):\n+        return self._common_roles().all()\n+\n     @property\n     def org_roles(self):\n-        return self.db.session.query(self._schema).except_(self.common_roles)\n+        return self.db.session.query(self._schema).except_(self._common_roles).all()\n \n     def first(self, **kwargs) -> Union[None, List]:\n         result = super().first(**kwargs)\n", "issue": "Add tests for domain's RoleManager\n## Description\r\nAdd unit tests for grid domain's RoleManager at the module `grid/apps/domain/src/main/core/manager`\r\n\r\n## Type of Test\r\n- [x] **Unit test** (e.g. checking a loop, method, or function is working as intended)\r\n- [ ] **Integration test** (e.g. checking if a certain group or set of functionality is working as intended)\r\n- [ ] **Regression test** (e.g. checking if by adding or removing a module of code allows other systems to continue to function as intended)\r\n- [ ] **Stress test** (e.g. checking to see how well a system performs under various situations, including heavy usage)\r\n- [ ] **Performance test** (e.g. checking to see how efficient a system is as performing the intended task)\r\n- [ ] Other...\r\n\r\n## Expected Behavior\r\nIdeally, the tests should cover as many methods as possible and within reason.\r\n\n", "before_files": [{"content": "# stdlib\nfrom typing import List\nfrom typing import Union\n\n# grid relative\nfrom ..database.tables.roles import Role\nfrom ..exceptions import RoleNotFoundError\nfrom .database_manager import DatabaseManager\n\n\nclass RoleManager(DatabaseManager):\n\n    schema = Role\n\n    def __init__(self, database):\n        self._schema = RoleManager.schema\n        self.db = database\n\n    @property\n    def user_role(self):\n        return self.first(name=\"User\")\n\n    @property\n    def owner_role(self):\n        return self.first(name=\"Owner\")\n\n    @property\n    def compliance_officer_role(self):\n        return self.first(name=\"Compliance Officer\")\n\n    @property\n    def admin_role(self):\n        return self.first(name=\"Administrator\")\n\n    @property\n    def common_roles(self):\n        return self.db.session.query(self._schema).filter_by(\n            can_triage_requests=False,\n            can_edit_settings=False,\n            can_create_users=False,\n            can_create_groups=False,\n            can_upload_data=False,\n            can_edit_roles=False,\n            can_manage_infrastructure=False,\n        )\n\n    @property\n    def org_roles(self):\n        return self.db.session.query(self._schema).except_(self.common_roles)\n\n    def first(self, **kwargs) -> Union[None, List]:\n        result = super().first(**kwargs)\n        if not result:\n            raise RoleNotFoundError\n        return result\n\n    def query(self, **kwargs) -> Union[None, List]:\n        results = super().query(**kwargs)\n        if len(results) == 0:\n            raise RoleNotFoundError\n        return results\n\n    def set(self, role_id, params):\n        if self.contain(id=role_id):\n            self.modify({\"id\": role_id}, params)\n        else:\n            raise RoleNotFoundError\n", "path": "packages/grid/apps/domain/src/main/core/manager/role_manager.py"}], "after_files": [{"content": "# stdlib\nfrom typing import List\nfrom typing import Union\n\nfrom flask_sqlalchemy import BaseQuery\n\n# grid relative\nfrom ..database.tables.roles import Role\nfrom ..exceptions import RoleNotFoundError\nfrom .database_manager import DatabaseManager\n\n\nclass RoleManager(DatabaseManager):\n\n    schema = Role\n\n    def __init__(self, database):\n        self._schema = RoleManager.schema\n        self.db = database\n\n    @property\n    def user_role(self):\n        return self.first(name=\"User\")\n\n    @property\n    def owner_role(self):\n        return self.first(name=\"Owner\")\n\n    @property\n    def compliance_officer_role(self):\n        return self.first(name=\"Compliance Officer\")\n\n    @property\n    def admin_role(self):\n        return self.first(name=\"Administrator\")\n\n    def _common_roles(self) -> BaseQuery:\n        return self.db.session.query(self._schema).filter_by(\n            can_triage_requests=False,\n            can_edit_settings=False,\n            can_create_users=False,\n            can_create_groups=False,\n            can_upload_data=False,\n            can_edit_roles=False,\n            can_manage_infrastructure=False,\n        )\n\n    @property\n    def common_roles(self):\n        return self._common_roles().all()\n\n    @property\n    def org_roles(self):\n        return self.db.session.query(self._schema).except_(self._common_roles).all()\n\n    def first(self, **kwargs) -> Union[None, List]:\n        result = super().first(**kwargs)\n        if not result:\n            raise RoleNotFoundError\n        return result\n\n    def query(self, **kwargs) -> Union[None, List]:\n        results = super().query(**kwargs)\n        if len(results) == 0:\n            raise RoleNotFoundError\n        return results\n\n    def set(self, role_id, params):\n        if self.contain(id=role_id):\n            self.modify({\"id\": role_id}, params)\n        else:\n            raise RoleNotFoundError\n", "path": "packages/grid/apps/domain/src/main/core/manager/role_manager.py"}]}