From 8fc430feb1857963a92c40e20c6aa9b5644a55a7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 14 Apr 2022 20:25:17 +0200 Subject: -test fixes --- src/cli/resources/00-backup.json | 2 +- src/cli/resources/01-backup.json | 24 +++------------- src/cli/resources/02-backup.json | 26 ++---------------- src/cli/resources/03-backup.json | 32 +++------------------- src/cli/resources/04-backup.json | 31 +++------------------ src/cli/test_anastasis_reducer_select_continent.sh | 14 ++++------ src/cli/test_anastasis_reducer_select_country.sh | 18 +++--------- src/cli/test_iban.sh | 5 ++-- 8 files changed, 28 insertions(+), 124 deletions(-) (limited to 'src/cli') diff --git a/src/cli/resources/00-backup.json b/src/cli/resources/00-backup.json index 6aa0311..700f8cd 100644 --- a/src/cli/resources/00-backup.json +++ b/src/cli/resources/00-backup.json @@ -2,7 +2,7 @@ "continents": [ "Europe", "North America", - "Testcontinent" + "Demoworld" ], "backup_state": "CONTINENT_SELECTING", "reducer_type": "backup" diff --git a/src/cli/resources/01-backup.json b/src/cli/resources/01-backup.json index 8bd2e93..be2a9d9 100644 --- a/src/cli/resources/01-backup.json +++ b/src/cli/resources/01-backup.json @@ -2,16 +2,16 @@ "continents": [ "Europe", "North America", - "Testcontinent" + "Demoworld" ], "backup_state": "COUNTRY_SELECTING", "reducer_type": "backup", - "selected_continent": "Testcontinent", + "selected_continent": "Demoworld", "countries": [ { "code": "xx", "name": "Testland", - "continent": "Testcontinent", + "continent": "Demoworld", "continent_i18n": { "xx": "Testkontinent" }, @@ -20,23 +20,7 @@ "de_CH": "Testlandi", "fr": "Testpais", "en": "Testland" - }, - "currency": "TESTKUDOS" - }, - { - "code": "xy", - "name": "Demoland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, - "name_i18n": { - "de_DE": "Demolandt", - "de_CH": "Demolandi", - "fr": "Demopais", - "en": "Demoland" - }, - "currency": "KUDOS" + } } ] } diff --git a/src/cli/resources/02-backup.json b/src/cli/resources/02-backup.json index 05ccab1..a298b69 100644 --- a/src/cli/resources/02-backup.json +++ b/src/cli/resources/02-backup.json @@ -2,7 +2,7 @@ "continents": [ "Europe", "North America", - "Testcontinent" + "Demoworld" ], "backup_state": "USER_ATTRIBUTES_COLLECTING", "reducer_type": "backup", @@ -11,32 +11,13 @@ { "code": "xx", "name": "Testland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, + "continent": "Demoworld", "name_i18n": { "de_DE": "Testlandt", "de_CH": "Testlandi", "fr": "Testpais", "en": "Testland" - }, - "currency": "TESTKUDOS" - }, - { - "code": "xy", - "name": "Demoland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, - "name_i18n": { - "de_DE": "Demolandt", - "de_CH": "Demolandi", - "fr": "Demopais", - "en": "Demoland" - }, - "currency": "KUDOS" + } } ], "authentication_providers": { @@ -46,7 +27,6 @@ "http://localhost:8089/": { "status" : "not-contacted" } }, "selected_country": "xx", - "currencies": [ "TESTKUDOS" ], "required_attributes": [ { "type": "string", diff --git a/src/cli/resources/03-backup.json b/src/cli/resources/03-backup.json index 838b669..15627a9 100644 --- a/src/cli/resources/03-backup.json +++ b/src/cli/resources/03-backup.json @@ -2,41 +2,22 @@ "continents": [ "Europe", "North America", - "Testcontinent" + "Demoworld" ], "backup_state": "AUTHENTICATIONS_EDITING", "reducer_type": "backup", - "selected_continent": "Testcontinent", + "selected_continent": "Demoworld", "countries": [ { "code": "xx", "name": "Testland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, + "continent": "Demoworld", "name_i18n": { "de_DE": "Testlandt", "de_CH": "Testlandi", "fr": "Testpais", "en": "Testland" - }, - "currency": "TESTKUDOS" - }, - { - "code": "xy", - "name": "Demoland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, - "name_i18n": { - "de_DE": "Demolandt", - "de_CH": "Demolandi", - "fr": "Demopais", - "en": "Demoland" - }, - "currency": "KUDOS" + } } ], "authentication_providers": { @@ -54,7 +35,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #1 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "F0HEYJQW81ZAZ3VYMZHFG8T1Z0", @@ -74,7 +54,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #2 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "D378FWXHJB8JHPQFQRZGGV9PWG", @@ -94,7 +73,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #3 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "7W9W4A4TTWSWRPJ76RNDPJHSPR", @@ -114,7 +92,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #4 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "PN0VJF6KDSBYN40SGRCEXPB07M", @@ -122,7 +99,6 @@ } }, "selected_country": "xx", - "currencies": ["TESTKUDOS"], "required_attributes": [ { "type": "string", diff --git a/src/cli/resources/04-backup.json b/src/cli/resources/04-backup.json index 3676f3e..c7dc6fe 100644 --- a/src/cli/resources/04-backup.json +++ b/src/cli/resources/04-backup.json @@ -2,41 +2,22 @@ "continents": [ "Europe", "North America", - "Testcontinent" + "Demoworld" ], "backup_state": "AUTHENTICATIONS_EDITING", "reducer_type": "backup", - "selected_continent": "Testcontinent", + "selected_continent": "Demoworld", "countries": [ { "code": "xx", "name": "Testland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, + "continent": "Demoworld", "name_i18n": { "de_DE": "Testlandt", "de_CH": "Testlandi", "fr": "Testpais", "en": "Testland" - }, - "currency": "TESTKUDOS" - }, - { - "code": "xy", - "name": "Demoland", - "continent": "Testcontinent", - "continent_i18n": { - "xx": "Testkontinent" - }, - "name_i18n": { - "de_DE": "Demolandt", - "de_CH": "Demolandi", - "fr": "Demopais", - "en": "Demoland" - }, - "currency": "KUDOS" + } } ], "authentication_providers": { @@ -54,7 +35,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #1 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "F0HEYJQW81ZAZ3VYMZHFG8T1Z0", @@ -74,7 +54,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #2 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "D378FWXHJB8JHPQFQRZGGV9PWG", @@ -94,7 +73,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #3 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "7W9W4A4TTWSWRPJ76RNDPJHSPR", @@ -114,7 +92,6 @@ "truth_lifetime": { "d_ms": 63115200000 }, - "currency": "TESTKUDOS", "business_name": "Data loss #4 Inc.", "storage_limit_in_megabytes": 1, "provider_salt": "PN0VJF6KDSBYN40SGRCEXPB07M", diff --git a/src/cli/test_anastasis_reducer_select_continent.sh b/src/cli/test_anastasis_reducer_select_continent.sh index 4cd8a84..bd1ce95 100755 --- a/src/cli/test_anastasis_reducer_select_continent.sh +++ b/src/cli/test_anastasis_reducer_select_continent.sh @@ -41,7 +41,7 @@ echo " FOUND" # Test continent selection in a backup state echo -n "Test continent selection in a backup state ..." -anastasis-reducer -a '{"continent": "Testcontinent"}' select_continent resources/00-backup.json $TFILE +anastasis-reducer -a '{"continent": "Demoworld"}' select_continent resources/00-backup.json $TFILE STATE=`jq -r -e .backup_state < $TFILE` if test "$STATE" != "COUNTRY_SELECTING" @@ -49,9 +49,9 @@ then exit_fail "Expected new state to be COUNTRY_SELECTING, got $STATE" fi SELECTED_CONTINENT=`jq -r -e .selected_continent < $TFILE` -if test "$SELECTED_CONTINENT" != "Testcontinent" +if test "$SELECTED_CONTINENT" != "Demoworld" then - exit_fail "Expected selected continent to be Testcontinent, got $SELECTED_CONTINENT" + exit_fail "Expected selected continent to be Demoworld, got $SELECTED_CONTINENT" fi COUNTRIES=`jq -r -e .countries < $TFILE` if test "$COUNTRIES" == NULL @@ -68,7 +68,7 @@ anastasis-reducer -a '{"continent": "Pangaia"}' select_continent resources/00-re echo " OK" echo -n "Test continent selection in a recovery state ..." -anastasis-reducer -a '{"continent": "Testcontinent"}' select_continent resources/00-recovery.json $TFILE +anastasis-reducer -a '{"continent": "Demoworld"}' select_continent resources/00-recovery.json $TFILE STATE=`jq -r -e .recovery_state < $TFILE` if test "$STATE" != "COUNTRY_SELECTING" @@ -79,12 +79,11 @@ jq -e .countries[0] < $TFILE > /dev/null || exit_fail "Expected new state to inc jq -e .countries[0].code < $TFILE > /dev/null || exit_fail "Expected new state to include countries with code" jq -e .countries[0].continent < $TFILE > /dev/null || exit_fail "Expected new state to include countries with continent" jq -e .countries[0].name < $TFILE > /dev/null || exit_fail "Expected new state to include countries with name" -jq -e .countries[0].currency < $TFILE > /dev/null || exit_fail "Expected new state to include countries with currency" SELECTED_CONTINENT=`jq -r -e .selected_continent < $TFILE` -if test "$SELECTED_CONTINENT" != "Testcontinent" +if test "$SELECTED_CONTINENT" != "Demoworld" then - exit_fail "Expected selected continent to be 'Testcontinent', got $SELECTED_CONTINENT" + exit_fail "Expected selected continent to be 'Demoworld', got $SELECTED_CONTINENT" fi COUNTRIES=`jq -r -e .countries < $TFILE` @@ -96,7 +95,6 @@ jq -e .countries[0] < $TFILE > /dev/null || exit_fail "Expected new state to inc jq -e .countries[0].code < $TFILE > /dev/null || exit_fail "Expected new state to include countries with code" jq -e .countries[0].continent < $TFILE > /dev/null || exit_fail "Expected new state to include countries with continent" jq -e .countries[0].name < $TFILE > /dev/null || exit_fail "Expected new state to include countries with name" -jq -e .countries[0].currency < $TFILE > /dev/null || exit_fail "Expected new state to include countries with currency" echo " OK" diff --git a/src/cli/test_anastasis_reducer_select_country.sh b/src/cli/test_anastasis_reducer_select_country.sh index c02f61f..2e18f44 100755 --- a/src/cli/test_anastasis_reducer_select_country.sh +++ b/src/cli/test_anastasis_reducer_select_country.sh @@ -63,12 +63,11 @@ jq -e .countries[0] < $TFILE > /dev/null || exit_fail "Expected new state to inc jq -e .countries[0].code < $TFILE > /dev/null || exit_fail "Expected new state to include countries with code" jq -e .countries[0].continent < $TFILE > /dev/null || exit_fail "Expected new state to include countries with continent" jq -e .countries[0].name < $TFILE > /dev/null || exit_fail "Expected new state to include countries with name" -jq -e .countries[0].currency < $TFILE > /dev/null || exit_fail "Expected new state to include countries with currency" SELECTED_CONTINENT=`jq -r -e .selected_continent < $TFILE` if test "$SELECTED_CONTINENT" != "Europe" then - exit_fail "Expected selected continent to be 'Testcontinent', got $SELECTED_CONTINENT" + exit_fail "Expected selected continent to be 'Europe', got $SELECTED_CONTINENT" fi echo " OK" @@ -84,8 +83,7 @@ echo " OK" echo -n "Test NX country selection ..." anastasis-reducer -a \ - '{"country_code": "zz", - "currencies": ["EUR" ]}' \ + '{"country_code": "zz"}' \ select_country \ resources/01-backup.json $TFILE 2> /dev/null \ && exit_fail "Expected selection to fail. Check '$TFILE'" @@ -95,8 +93,7 @@ echo " OK" echo -n "Test invalid country selection for continent ..." anastasis-reducer -a \ - '{"country_code": "de", - "currencies":["EUR"]}' \ + '{"country_code": "de"}' \ select_country \ resources/01-backup.json $TFILE 2> /dev/null \ && exit_fail "Expected selection to fail. Check '$TFILE'" @@ -106,8 +103,7 @@ echo " OK" echo -n "Test country selection ..." anastasis-reducer -a \ - '{"country_code": "xx", - "currencies":["TESTKUDOS"]}' \ + '{"country_code": "xx"}' \ select_country resources/01-backup.json $TFILE STATE=`jq -r -e .backup_state < $TFILE` @@ -122,12 +118,6 @@ then exit_fail "Expected selected country to be 'xx', got '$SELECTED_COUNTRY'" fi echo -n "." -SELECTED_CURRENCY=`jq -r -e .currencies[0] < $TFILE` -if test "$SELECTED_CURRENCY" != "TESTKUDOS" -then - exit_fail "Expected selected currency to be 'TESTKUDOS', got '$SELECTED_CURRENCY'" -fi -echo -n "." REQ_ATTRIBUTES=`jq -r -e .required_attributes < $TFILE` if test "$REQ_ATTRIBUTES" == NULL then diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh index 523e047..b14820e 100755 --- a/src/cli/test_iban.sh +++ b/src/cli/test_iban.sh @@ -300,12 +300,11 @@ echo -n "Running backup logic ...," anastasis-reducer -b > $B1FILE echo -n "." anastasis-reducer -a \ - '{"continent": "Testcontinent"}' \ + '{"continent": "Demoworld"}' \ select_continent < $B1FILE > $B2FILE echo -n "." anastasis-reducer -a \ - '{"country_code": "xx", - "currencies":["TESTKUDOS"]}' \ + '{"country_code": "xx" }' \ select_country < $B2FILE > $B1FILE 2>> test_reducer.err echo -n "." -- cgit v1.2.3