-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The initialization config for the tests are now using the same config as middleware is using when a new environment is bootstrapped. After the initial setup of the tests a mysqldump is created in order to run all test in isolation and prevent unwanted side effects. And the event stream is no only used to boostrap an SRAA with a token.
- Loading branch information
1 parent
0aa8df1
commit a64e981
Showing
10 changed files
with
320 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/vendor | ||
/vendor | ||
setup.sql |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
stepup/tests/behat/fixtures/middleware-institution.json
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,133 @@ | ||
{ | ||
"dev.openconext.local": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 5, | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": true | ||
}, | ||
"institution-a.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": true, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"self_vet": true, | ||
"sso_on_2fa": true, | ||
"allow_self_asserted_tokens": true | ||
}, | ||
"institution-b.example.com": { | ||
"use_ra_locations": false, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"self_vet": true, | ||
"sso_on_2fa": true, | ||
"allow_self_asserted_tokens": true | ||
}, | ||
"institution-d.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": false, | ||
"verify_email": true, | ||
"allowed_second_factors": [ | ||
"yubikey", | ||
"tiqr" | ||
], | ||
"number_of_tokens_per_identity": 1, | ||
"self_vet": false, | ||
"allow_self_asserted_tokens": false | ||
}, | ||
"institution-f.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": false, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"use_ra": [ | ||
"institution-f.example.com", | ||
"institution-a.example.com", | ||
"institution-b.example.com" | ||
], | ||
"use_raa": [ | ||
"institution-f.example.com", | ||
"institution-a.example.com" | ||
], | ||
"select_raa": [ | ||
"institution-f.example.com" | ||
], | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": false | ||
}, | ||
"institution-g.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"use_ra": [ | ||
"institution-g.example.com" | ||
], | ||
"use_raa": [ | ||
"institution-g.example.com" | ||
], | ||
"select_raa": [ | ||
"institution-h.example.com", | ||
"institution-g.example.com" | ||
], | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": false | ||
}, | ||
"institution-h.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"use_ra": [ | ||
"institution-h.example.com" | ||
], | ||
"use_raa": [ | ||
"institution-h.example.com" | ||
], | ||
"select_raa": [ | ||
"institution-h.example.com", | ||
"institution-g.example.com" | ||
], | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": true | ||
}, | ||
"institution-v.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"use_ra": [], | ||
"use_raa": [], | ||
"select_raa": [ | ||
"institution-a.example.com", | ||
"institution-b.example.com" | ||
], | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": false | ||
}, | ||
"institution-i.example.com": { | ||
"use_ra_locations": true, | ||
"show_raa_contact_information": true, | ||
"verify_email": false, | ||
"allowed_second_factors": [], | ||
"number_of_tokens_per_identity": 2, | ||
"use_ra": [ | ||
"institution-v.example.com" | ||
], | ||
"use_raa": [ | ||
"institution-v.example.com" | ||
], | ||
"select_raa": [], | ||
"self_vet": true, | ||
"allow_self_asserted_tokens": false | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
stepup/tests/behat/fixtures/middleware-push-institution.sh
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,50 @@ | ||
#!/bin/bash | ||
|
||
CWD=$(pwd) | ||
|
||
function error_exit { | ||
echo "${1}" | ||
if [ -n "${TMP_FILE}" -a -d "${TMP_FILE}" ]; then | ||
rm "${TMP_FILE}" | ||
fi | ||
cd "${CWD}" | ||
exit 1 | ||
} | ||
|
||
# Script to write the middleware institution config | ||
|
||
TMP_FILE=$(mktemp -t midcfg.XXXXXX) | ||
if [ $? -ne "0" ]; then | ||
error_exit "Could not create temp file" | ||
fi | ||
|
||
echo "Pushing new institution configuration to: https://middleware.dev.openconext.local/management/institution-configuration" | ||
|
||
http_response=$(curl -k --write-out %\{http_code\} --output "${TMP_FILE}" -XPOST -s \ | ||
-u management:secret \ | ||
-H "Accept: application/json" \ | ||
-H "Content-type: application/json" \ | ||
-d @./fixtures/middleware-institution.json \ | ||
https://middleware.dev.openconext.local/management/institution-configuration) | ||
|
||
output=$(cat ${TMP_FILE}) | ||
rm ${TMP_FILE} | ||
echo $output | ||
|
||
res=$? | ||
if [ $res -ne "0" ]; then | ||
error_exit "Curl failed with code $res" | ||
fi | ||
|
||
# Check for HTTP 200 | ||
if [ "${http_response}" -ne "200" ]; then | ||
error_exit "Unexpected HTTP response: ${http_response}" | ||
fi | ||
|
||
# On success JSON output should start with: {"status":"OK" | ||
ok_count=$(echo "${output}" | grep -c "status") | ||
if [ $ok_count -ne "1" ]; then | ||
error_exit "Expected one JSON \"status: OK\" in response, found $ok_count" | ||
fi | ||
|
||
echo "OK. New config pushed" |
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,51 @@ | ||
#!/bin/bash | ||
|
||
CWD=$(pwd) | ||
|
||
function error_exit { | ||
echo "${1}" | ||
if [ -n "${TMP_FILE}" -a -d "${TMP_FILE}" ]; then | ||
rm "${TMP_FILE}" | ||
fi | ||
cd ${CWD} | ||
exit 1 | ||
} | ||
|
||
# Script to write the middleware institution whitelist | ||
|
||
TMP_FILE=$(mktemp -t midcfg.XXXXXX) | ||
if [ $? -ne "0" ]; then | ||
error_exit "Could not create temp file" | ||
fi | ||
|
||
echo "Pushing new institution whitelist to: http://middleware.dev.openconext.local/management/whitelist/replace" | ||
|
||
http_response=$(curl -k --write-out %{http_code} --output ${TMP_FILE} -XPOST -s \ | ||
-u management:secret \ | ||
-H "Accept: application/json" \ | ||
-H "Content-type: application/json" \ | ||
-d @./fixtures/middleware-whitelist.json \ | ||
https://middleware.dev.openconext.local/management/whitelist/replace) | ||
|
||
res=$? | ||
|
||
output=$(cat "${TMP_FILE}") | ||
rm "${TMP_FILE}" | ||
echo "$output" | ||
|
||
if [ $res -ne "0" ]; then | ||
error_exit "Curl failed with code $res" | ||
fi | ||
|
||
# Check for HTTP 200 | ||
if [ "${http_response}" -ne "200" ]; then | ||
error_exit "Unexpected HTTP response: ${http_response}" | ||
fi | ||
|
||
# On success JSON output should start with: {"status":"OK" | ||
ok_count=$(echo "${output}" | grep -c "status") | ||
if [ $ok_count -ne "1" ]; then | ||
error_exit "Expected one JSON \"status: OK\" in response, found $ok_count" | ||
fi | ||
|
||
echo "OK. New config pushed" |
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,15 @@ | ||
{ | ||
"institutions": [ | ||
"dev.openconext.local", | ||
"institution-a.example.com", | ||
"institution-b.example.com", | ||
"institution-d.example.com", | ||
"institution-e.example.com", | ||
"institution-f.example.com", | ||
"institution-g.example.com", | ||
"institution-h.example.com", | ||
"institution-i.example.com", | ||
"institution-j.example.com", | ||
"institution-v.example.com" | ||
] | ||
} |