Skip to content

Commit

Permalink
Load all systems if there are no groups
Browse files Browse the repository at this point in the history
  • Loading branch information
upadhyeammit committed Sep 13, 2023
1 parent f132755 commit 39c2854
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions ros/api/common/add_group_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def group_filtered_query(query):
if get_flag_value(FLAG_INVENTORY_GROUPS):
if len(get_host_groups()) >= 1:
query = query.filter(System.groups[0]['id'].astext.in_(get_host_groups()) | (System.groups == '[]'))
else:
query = query.filter((System.groups == '[]'))
return query


Expand Down
4 changes: 2 additions & 2 deletions tests/test_api_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def test_systems_rbac_returns_emtpy_group(
mock_rbac(get_rbac_mock_file("mock_rbac_returns_emtpy_group.json"), mocker)
response = client.get('/api/ros/v1/systems', headers={"x-rh-identity": auth_token})
assert response.status_code == 200
assert response.json["meta"]["count"] == 1
assert response.json["meta"]["count"] == 4
assert response.json["data"][0]["groups"] == []


Expand All @@ -509,7 +509,7 @@ def test_systems_mock_rbac_returns_no_groups(
mock_rbac(get_rbac_mock_file("mock_rbac_returns_no_groups.json"), mocker)
response = client.get('/api/ros/v1/systems', headers={"x-rh-identity": auth_token})
assert response.status_code == 200
assert response.json["meta"]["count"] == 1
assert response.json["meta"]["count"] == 4


def test_systems_mock_rbac_returns_multiple_inventory_hosts_read(
Expand Down

0 comments on commit 39c2854

Please sign in to comment.