forked from pulp/pulp-cli
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable sending query parameters for selecting and ordering
closes pulp#542
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck source=tests/scripts/config.source | ||
. "$(dirname "$(dirname "$(realpath "$0")")")"/config.source | ||
|
||
cleanup() { | ||
pulp file repository destroy --name aaaaaaaaaa || true | ||
pulp file repository destroy --name bbbbbbbbbb || true | ||
pulp file repository destroy --name cccccccccc || true | ||
} | ||
trap cleanup EXIT | ||
|
||
expect_succ pulp file repository create --name aaaaaaaaaa | ||
expect_succ pulp file repository create --name bbbbbbbbbb | ||
expect_succ pulp file repository create --name cccccccccc | ||
|
||
expect_succ pulp file repository list --ordering -name | ||
ORDERED_RESULTS=$(echo "$OUTPUT" | jq -r .[].name | tr "\n" " " | xargs) | ||
EXPECTED_RESULTS="cccccccccc bbbbbbbbbb aaaaaaaaaa" | ||
if [[ "$ORDERED_RESULTS" != "$EXPECTED_RESULTS" ]]; then | ||
echo "Ordered results do not match: {$ORDERED_RESULTS} != {$EXPECTED_RESULTS}" | ||
exit 1 | ||
fi | ||
|
||
expect_succ pulp file repository list --field name --field remote | ||
SELECTED_FIELDS=$(echo "$OUTPUT" | jq -r ".[] | keys[]" | sort| tr "\n" " " | xargs) | ||
EXPECTED_FIELDS="name name name remote remote remote" | ||
if [[ "$SELECTED_FIELDS" != "$EXPECTED_FIELDS" ]]; then | ||
echo "Selected fields do not match: {$SELECTED_FIELDS} != {$EXPECTED_FIELDS}" | ||
exit 1 | ||
fi | ||
|
||
expect_succ pulp file repository list --exclude-field name --exclude-field remote | ||
EXCLUDED_FIELDS=$(echo "$OUTPUT" | jq -r ".[] | keys[]" | tr "\n" " " ) | ||
|
||
if [[ "$EXCLUDED_FIELDS" == *"name"* ]]; then | ||
echo "The name field was not excluded from {$EXCLUDED_FIELDS}" | ||
exit 1 | ||
fi | ||
if [[ "$EXCLUDED_FIELDS" == *"remote"* ]]; then | ||
echo "The name field was not excluded from {$EXCLUDED_FIELDS}" | ||
exit 1 | ||
fi |