@@ -45,26 +45,26 @@ if [[ $OUT != *"\"policies\": []"* ]]; then
4545 exit 1
4646fi
4747
48- # Create the default set of policies and then get them. There should
48+ # Create the default set of policies and then fetch them. There should
4949# be 1, corresponding to the system falco rule.
5050$SCRIPTDIR /../examples/create_default_policies.py $PYTHON_SDC_TEST_API_TOKEN
5151OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
52- if [[ $OUT != * " \" name \" : \" Write below binary dir\" " * ]]; then
52+ if [[ $OUT != * " \" Write below binary dir\" " * ]]; then
5353 echo " Unexpected output after creating default policies"
5454 exit 1
5555fi
5656
5757# Get that policy, change the name, and create a new duplicate policy.
5858OUT=` $SCRIPTDIR /../examples/get_policy.py $PYTHON_SDC_TEST_API_TOKEN " Write below binary dir" `
5959MY_POLICY=$OUT
60- if [[ $OUT != * " \" name \" : \" Write below binary dir\" " * ]]; then
60+ if [[ $OUT != * " \" Write below binary dir\" " * ]]; then
6161 echo " Could not fetch policy with name \" Write below binary dir\" "
6262 exit 1
6363fi
6464
6565NEW_POLICY=` echo $MY_POLICY | sed -e " s/Write below binary dir/Copy Of Write below binary dir/g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
6666OUT=` echo $NEW_POLICY | $SCRIPTDIR /../examples/add_policy.py $PYTHON_SDC_TEST_API_TOKEN `
67- if [[ $OUT != * " \" name \" : \" Copy Of Write below binary dir\" " * ]]; then
67+ if [[ $OUT != * " \" Copy Of Write below binary dir\" " * ]]; then
6868 echo " Could not create new policy"
6969 exit 1
7070fi
7979
8080# Delete the new policy.
8181OUT=` $SCRIPTDIR /../examples/delete_policy.py --name " Copy Of Write below binary dir" $PYTHON_SDC_TEST_API_TOKEN `
82- if [[ $OUT != * " \" name \" : \" Copy Of Write below binary dir\" " * ]]; then
82+ if [[ $OUT != * " \" Copy Of Write below binary dir\" " * ]]; then
8383 echo " Could not delete policy \" Copy Of Write below binary dir\" "
8484 exit 1
8585fi
8686
8787OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
88- if [[ $OUT = * " \" name \" : \" Copy Of Write below binary dir\" " * ]]; then
88+ if [[ $OUT = * " \" Copy Of Write below binary dir\" " * ]]; then
8989 echo " After deleting policy Copy Of Write below binary dir, policy was still present?"
9090 exit 1
9191fi
9292
9393# Make a copy again, but this time delete by id
9494NEW_POLICY=` echo $MY_POLICY | sed -e " s/Write below binary dir/Another Copy Of Write below binary dir/g" | sed -e ' s/"id": [0-9]*,//' | sed -e ' s/"version": [0-9]*/"version": null/' `
9595OUT=` echo $NEW_POLICY | $SCRIPTDIR /../examples/add_policy.py $PYTHON_SDC_TEST_API_TOKEN `
96- if [[ $OUT != * " \" name \" : \" Another Copy Of Write below binary dir\" " * ]]; then
96+ if [[ $OUT != * " \" Another Copy Of Write below binary dir\" " * ]]; then
9797 echo " Could not create new policy"
9898 exit 1
9999fi
100100
101101ID=` echo $OUT | grep -E -o ' "id": [^,]+,' | awk ' {print $2}' | awk -F, ' {print $1}' `
102102
103103OUT=` $SCRIPTDIR /../examples/delete_policy.py --id $ID $PYTHON_SDC_TEST_API_TOKEN `
104- if [[ $OUT != * " \" name \" : \" Another Copy Of Write below binary dir\" " * ]]; then
104+ if [[ $OUT != * " \" Another Copy Of Write below binary dir\" " * ]]; then
105105 echo " Could not delete policy \" Copy Of Write below binary dir\" "
106106 exit 1
107107fi
108108
109109OUT=` $SCRIPTDIR /../examples/list_policies.py $PYTHON_SDC_TEST_API_TOKEN `
110- if [[ $OUT = * " \" name \" : \" Another Copy Of Write below binary dir\" " * ]]; then
110+ if [[ $OUT = * " \" Another Copy Of Write below binary dir\" " * ]]; then
111111 echo " After deleting policy Another Copy Of Write below binary dir, policy was still present?"
112112 exit 1
113113fi
0 commit comments