-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8570192
commit e26c60e
Showing
10 changed files
with
176 additions
and
2 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
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,19 @@ | ||
ALTER TABLE | ||
funding | ||
ADD COLUMN IF NOT EXISTS | ||
token_hash | ||
TEXT NOT NULL DEFAULT | ||
''; | ||
|
||
ALTER TABLE | ||
funding | ||
ADD COLUMN IF NOT EXISTS | ||
cost_per_month_usd | ||
FLOAT NOT NULL DEFAULT | ||
360.0; | ||
|
||
ALTER TABLE | ||
funding | ||
ALTER COLUMN | ||
cost_per_month_usd | ||
DROP DEFAULT; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This test is mostly intended to verify that the `verificationjobrunner` runs | ||
# the jobs. The unit tests for the `verification` Python module are much | ||
# more in-depth. | ||
|
||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
cd "$script_dir" | ||
|
||
source ../util/setup.sh | ||
|
||
set -xe | ||
|
||
q " | ||
update | ||
funding | ||
set | ||
estimated_end_date = '2024-09-17 15:02:10.866', | ||
token_hash = '$(printf 'valid-token' | sha512sum | cut -d' ' -f1)', | ||
cost_per_month_usd = 100.0 | ||
" | ||
|
||
|
||
|
||
echo 'Invalid tokens are ignored' | ||
|
||
jc POST /kofi-donation -d '{ | ||
"verification_token": "invalid-token", | ||
"message_id": "4859ebc6-6721-4e93-9f8e-12dc08d1cda4", | ||
"timestamp": "2024-12-26T10:52:52Z", | ||
"type": "Donation", | ||
"is_public": true, | ||
"from_name": "Jo Example", | ||
"message": "Good luck with the integration!", | ||
"amount": "3.00", | ||
"url": "https://ko-fi.com/Home/CoffeeShop?txid=00000000-1111-2222-3333-444444444444", | ||
"email": "[email protected]", | ||
"currency": "USD", | ||
"is_subscription_payment": false, | ||
"is_first_subscription_payment": false, | ||
"kofi_transaction_id": "00000000-1111-2222-3333-444444444444", | ||
"shop_items": null, | ||
"tier_name": null, | ||
"shipping": null | ||
}' | ||
|
||
actual=$(q "select estimated_end_date from funding") | ||
expected='2024-09-17 15:02:10.866' | ||
|
||
diff <(echo "$actual") <(echo "$expected") | ||
|
||
|
||
|
||
echo 'The estimated end date increases when adding 50.0 dollars' | ||
|
||
test_token_hash=$(sha512sum <<< "test-token") | ||
|
||
jc POST /kofi-donation -d '{ | ||
"verification_token": "valid-token", | ||
"message_id": "4859ebc6-6721-4e93-9f8e-12dc08d1cda4", | ||
"timestamp": "2024-12-26T10:52:52Z", | ||
"type": "Donation", | ||
"is_public": true, | ||
"from_name": "Jo Example", | ||
"message": "Good luck with the integration!", | ||
"amount": "50.00", | ||
"url": "https://ko-fi.com/Home/CoffeeShop?txid=00000000-1111-2222-3333-444444444444", | ||
"email": "[email protected]", | ||
"currency": "USD", | ||
"is_subscription_payment": false, | ||
"is_first_subscription_payment": false, | ||
"kofi_transaction_id": "00000000-1111-2222-3333-444444444444", | ||
"shop_items": null, | ||
"tier_name": null, | ||
"shipping": null | ||
}' | ||
|
||
actual=$(q "select estimated_end_date from funding") | ||
expected='2024-10-01 15:02:10.866' | ||
|
||
diff <(echo "$actual") <(echo "$expected") |
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
cd "$script_dir" | ||
|
||
for t in ./functionality5/*.sh | ||
do | ||
output=$( "$t" 2>&1 ) || { | ||
rc=$? | ||
echo "$output" | ||
echo "Test failed: $t" | ||
exit "$rc" | ||
} | ||
done |
File renamed without changes.