Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/mas/devops/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def manage_internal_ca_pem_file_path(self):
@property
def mas_workspace_application_ids(self):
if self._mas_workspace_application_ids is None:
self._mas_workspace_application_ids = list(map(lambda ma: ma["id"], self.get_mas_applications_in_workspace()))
# Filter out "health"
all_apps = self.get_mas_applications_in_workspace()
self._mas_workspace_application_ids = [app["id"] for app in all_apps if app["id"] != "health"]
return self._mas_workspace_application_ids

def get_user(self, user_id):
Expand Down
12 changes: 12 additions & 0 deletions test/src/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,18 @@ def test_mas_workspace_application_ids(user_utils, requests_mock):
assert get.call_count == 1


def test_mas_workspace_application_ids_filters_health(user_utils, requests_mock):
get = requests_mock.get(
f"{MAS_API_URL}/workspaces/{MAS_WORKSPACE_ID}/applications",
request_headers={"x-access-token": TOKEN},
json=[{"id": "manage"}, {"id": "health"}, {"id": "iot"}],
status_code=200
)
# health should be filtered out
assert user_utils.mas_workspace_application_ids == ["manage", "iot"]
assert get.call_count == 1


def test_get_user_exists(user_utils, requests_mock, mock_manage_api_key):
user_id = "user1"
get_core, get_manage, get_manage_personid = mock_get_user_200(requests_mock, user_id, mock_manage_api_key)
Expand Down
Loading