From dd1940cecb8749f8d34be89effaa6383ac966214 Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Wed, 11 Dec 2024 07:42:25 +0100 Subject: [PATCH] tests: update tests to use fixed json output --- tests/manual/common/select/select_context_shaping.yaml | 3 ++- tests/manual/common/select/select_flat_selection.yaml | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/manual/common/select/select_context_shaping.yaml b/tests/manual/common/select/select_context_shaping.yaml index 995675153..fded2e82f 100644 --- a/tests/manual/common/select/select_context_shaping.yaml +++ b/tests/manual/common/select/select_context_shaping.yaml @@ -24,7 +24,8 @@ tests: It adds nested objects under a property name when using globstar **: command: | - c8y devices list --select "id:id,links:**.self" --pageSize 1 + echo '{"additionParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/additionParents"},"assetParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/assetParents"},"c8y_IsDevice":{},"c8y_SupportedLogs":["software-management"],"c8y_SupportedOperations":["c8y_LogfileRequest","c8y_Restart","c8y_SoftwareUpdate"],"childAdditions":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAdditions"},"childAssets":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAssets"},"childDevices":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childDevices"},"com_cumulocity_model_Agent":{},"creationTime":"2022-02-15T17:43:55.737Z","deviceParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/deviceParents"},"id":"12345","lastUpdated":"2022-02-23T11:57:02.657Z","name":"test","owner":"device_test","self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345","type":"thin-edge.io"}' | + c8y util show --select "id:id,links:**.self" stdout: json: id: r/\d+$ diff --git a/tests/manual/common/select/select_flat_selection.yaml b/tests/manual/common/select/select_flat_selection.yaml index b1e0bda37..ae32309b7 100644 --- a/tests/manual/common/select/select_flat_selection.yaml +++ b/tests/manual/common/select/select_flat_selection.yaml @@ -79,14 +79,16 @@ tests: It returns only objects on the selected level with the self property (1 level): command: | - c8y devices list --select "*.self" --pageSize 1 + echo '{"additionParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/additionParents"},"assetParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/assetParents"},"c8y_IsDevice":{},"c8y_SupportedLogs":["software-management"],"c8y_SupportedOperations":["c8y_LogfileRequest","c8y_Restart","c8y_SoftwareUpdate"],"childAdditions":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAdditions"},"childAssets":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAssets"},"childDevices":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childDevices"},"com_cumulocity_model_Agent":{},"creationTime":"2022-02-15T17:43:55.737Z","deviceParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/deviceParents"},"id":"12345","lastUpdated":"2022-02-23T11:57:02.657Z","name":"test","owner":"device_test","self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345","type":"thin-edge.io"}' | + c8y util show --select "*.self" stdout: # no globstar was used, so depth matching is explicit by number of dots match-pattern: '{"additionParents":{"self":".+"},"assetParents":{"self":".+"},"childAdditions":{"self":".+"},"childAssets":{"self":".+"},"childDevices":{"self":".+"},"deviceParents":{"self":".+"}}' It returns only objects on the selected level with the self property (multi level): command: | - c8y devices list --select "**.self" --pageSize 1 + echo '{"additionParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/additionParents"},"assetParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/assetParents"},"c8y_IsDevice":{},"c8y_SupportedLogs":["software-management"],"c8y_SupportedOperations":["c8y_LogfileRequest","c8y_Restart","c8y_SoftwareUpdate"],"childAdditions":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAdditions"},"childAssets":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childAssets"},"childDevices":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/childDevices"},"com_cumulocity_model_Agent":{},"creationTime":"2022-02-15T17:43:55.737Z","deviceParents":{"references":[],"self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345/deviceParents"},"id":"12345","lastUpdated":"2022-02-23T11:57:02.657Z","name":"test","owner":"device_test","self":"https://t12345.example.cumulocity.com/inventory/managedObjects/12345","type":"thin-edge.io"}' | + c8y util show --select "**.self" stdout: # globstar was used, so matching can occur on any depth match-pattern: '{"additionParents":{"self":".+"},"assetParents":{"self":".+"},"childAdditions":{"self":".+"},"childAssets":{"self":".+"},"childDevices":{"self":".+"},"deviceParents":{"self":".+"},"self":".+"}'