Skip to content

Commit 2318d3e

Browse files
committed
Fixed imports for projects without client-side filtering support.
1 parent cc7f901 commit 2318d3e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

integration_tests/test_devicegroups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_select(live_c8y: CumulocityApi, safe_executor):
151151
# 4) select with client-side filtering
152152
filtered_roots_1 = live_c8y.group_inventory.get_all(
153153
type=DeviceGroup.ROOT_TYPE,
154-
include="starts_with(name, 'Root-')",
154+
include="name matches 'Root-.*'",
155155
as_values='name')
156156
filtered_roots_2 = [
157157
x for x in live_c8y.group_inventory.get_all(type=DeviceGroup.ROOT_TYPE, as_values='name')

integration_tests/test_global_roles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ def test_select(live_c8y: CumulocityApi, safe_create):
6161
assert role.id in [x.id for x in selected_roles]
6262

6363
# (4) select with filter
64-
filtered_1 = live_c8y.global_roles.get_all(include="contains(name, 'Global')")
64+
filtered_1 = live_c8y.global_roles.get_all(include="name contains Global")
6565
filtered_2 = [x for x in live_c8y.global_roles.get_all() if 'Global' in x.name]
6666
assert {x.name for x in filtered_1} == {x.name for x in filtered_2}
6767

6868
# (5) select by user with filter
69-
filtered_1 = live_c8y.global_roles.get_all(username=username, include="contains(name, 'a')")
69+
filtered_1 = live_c8y.global_roles.get_all(username=username, include="name contains a")
7070
filtered_2 = [x for x in live_c8y.global_roles.get_all(username=username) if 'a' in x.name]
7171
assert {x.name for x in filtered_1} == {x.name for x in filtered_2}
7272

integration_tests/test_inventoryroles.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from c8y_api import CumulocityApi
66
from c8y_api.model import User, InventoryRole, Permission, ReadPermission, WritePermission, AnyPermission
7+
from c8y_api.model.matcher import jmespath
78

89
from util.testing_util import RandomNameGenerator
910

@@ -82,7 +83,7 @@ def test_select_inventory_roles(live_c8y: CumulocityApi):
8283
assert live_c8y.inventory_roles.get_all()
8384

8485
# (2) filter
85-
filtered_1 = live_c8y.inventory_roles.get_all(include='description != null')
86+
filtered_1 = live_c8y.inventory_roles.get_all(include=jmespath('description != null'))
8687
filtered_2 = [x for x in live_c8y.inventory_roles.get_all() if x.description]
8788
assert {x.id for x in filtered_1} == {x.id for x in filtered_2}
8889

integration_tests/test_users.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from c8y_api import CumulocityApi
1414
from c8y_api.model import User
15+
from c8y_api.model.matcher import jmespath
1516

1617
from util.testing_util import RandomNameGenerator
1718

@@ -76,7 +77,7 @@ def test_select(live_c8y: CumulocityApi, safe_create):
7677
assert '2' in live_c8y.users.get(user.username).global_role_ids
7778

7879
# test getting with a client-side-filter
79-
admin_users_2 = live_c8y.users.get_all(include="contains(groups.references[].group.id, `2`)")
80+
admin_users_2 = live_c8y.users.get_all(include=jmespath("contains(groups.references[].group.id, `2`)"))
8081
assert {x.id for x in admin_users} == {x.id for x in admin_users_2}
8182

8283

0 commit comments

Comments
 (0)