ftest tests for the WebFinger protocol
Aravinth Manivannan
c4fad0b0d7
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
|
||
---|---|---|
.reuse | ||
LICENSES | ||
.dockerignore | ||
.env_sample | ||
.gitignore | ||
.woodpecker.yml | ||
Dockerfile | ||
README.md | ||
run.py |
WebFinger tests for ForgeFlux/ftest
TODO
- Write code to upload to ftest server
- Package Docker container
- Upload to Docker Hub
Environment Variables
Please see .env_sample
NAME | Purpose | Example |
---|---|---|
FTEST_AUTH |
Authorization token for uploading test results to ftest server | a random-generated string that will be provided by ftest server |
FTEST_HOST |
The URL of the ftest's instance to which tests results should be uploaded | http://localhost:5000 , if an ftest implementation is running on localhost at port 5000 |
FTEST_TARGET_HOST |
The URL of the implementation's instance against which tests will be run | http://localhost:3000 , if Forgejo or any other WebFinger implementation is running on localhost at port 3000 |
FTEST_USER |
address of the actor against which WebFinger tests will be run | john@localhost:3000 . User john should exist on the instance |
Usage
cp .env_sample .env # edit and populate .env with the right values
source .env
python run.py
Docker
cp .env_sample .env # edit and populate .env with the right values
source .env
docker run \
-e FTEST_AUTH=$FTEST_AUTH \
-e FTEST_TARGET_HOST=$FTEST_TARGET_HOST \
-e FTEST_USER=$FTEST_USER forgeflux/webfinger-test
Demo
Successful run:
Please open to see logs
19:54 atm@lab webfinger ±|master|→ python run.py
2023-09-06 19:54:29,351 - webfinger - INFO - Environment: FTEST_AUTH: foobar
2023-09-06 19:54:29,351 - webfinger - INFO - Environment: FTEST_TARGET_HOST: https://gts.batsense.net
2023-09-06 19:54:29,351 - webfinger - INFO - Environment: FTEST_USER: realaravinth@batsense.net
2023-09-06 19:54:29,351 - webfinger - INFO - Query WebFinger: https://gts.batsense.net/.well-known/webfinger?resource=acct:realaravinth@batsense.net
2023-09-06 19:54:30,940 - webfinger - DEBUG - WebFinger response:
STATUS: 200
HEADERS:
{'Server': 'nginx/1.18.0', 'Date': 'Wed, 06 Sep 2023 14:24:21 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '197', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Access-Control-Expose-Headers': 'Link,X-Ratelimit-Reset,X-Ratelimit-Limit,X-Ratelimit-Remaining,X-Request-Id,Connection,Sec-Websocket-Accept,Upgrade', 'Cache-Control': 'public, max-age=120', 'Content-Encoding': 'gzip', 'Permissions-Policy': 'browsing-topics=(), interest-cohort=()', 'Vary': 'Accept-Encoding', 'X-Ratelimit-Limit': '300', 'X-Ratelimit-Remaining': '299', 'X-Ratelimit-Reset': '1694010561', 'X-Request-Id': 'tx0y2tma04001mwdmrb0'}
RESPONSE PAYLOAD:
{'subject': 'acct:realaravinth@batsense.net', 'aliases': ['https://gts.batsense.net/users/realaravinth', 'https://gts.batsense.net/@realaravinth'], 'links': [{'rel': 'http://webfinger.net/rel/profile-page', 'type': 'text/html', 'href': 'https://gts.batsense.net/@realaravinth'}, {'rel': 'self', 'type': 'application/activity+json', 'href': 'https://gts.batsense.net/users/realaravinth'}]}
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCCESS] WebFinger query response is HTTP 200
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCCESS] WebFinger response has 'subject', 'aliases' and 'links' parameters'
2023-09-06 19:54:30,940 - webfinger - DEBUG - 'rel==http://webfinger.net/rel/profile-page' is present in 'links' WebFinger response parameter
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCESS] rel==self passed schema validation
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCESS] rel==profile-page passed schema validation
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCESS] 'links' object passed validation
2023-09-06 19:54:30,940 - webfinger - INFO - [SUCESS] WebFinger endpoint is configured correctly for CORS
===============
All tests passed
Summary:
Successful tests:
[OK] test_main_params
[OK] test_links
[OK] test_subject
[OK] test_access_control_allow_origin
Failed run:
Please open to see logs
19:59 atm@lab webfinger ±|master ✗|→ python run.py
2023-09-06 19:59:25,423 - webfinger - INFO - Environment: FTEST_AUTH: foobar
2023-09-06 19:59:25,423 - webfinger - INFO - Environment: FTEST_TARGET_HOST: https://gts.batsense.net
2023-09-06 19:59:25,423 - webfinger - INFO - Environment: FTEST_USER: realaravinth@batsense.net
2023-09-06 19:59:25,423 - webfinger - INFO - Query WebFinger: https://gts.batsense.net/.well-known/webfinger?resource=acct:realaravinth@batsense.net
2023-09-06 19:59:26,966 - webfinger - DEBUG - WebFinger response:
STATUS: 200
HEADERS:
{'Server': 'nginx/1.18.0', 'Date': 'Wed, 06 Sep 2023 14:29:18 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '197', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Access-Control-Expose-Headers': 'Link,X-Ratelimit-Reset,X-Ratelimit-Limit,X-Ratelimit-Remaining,X-Request-Id,Connection,Sec-Websocket-Accept,Upgrade', 'Cache-Control': 'public, max-age=120', 'Content-Encoding': 'gzip', 'Permissions-Policy': 'browsing-topics=(), interest-cohort=()', 'Vary': 'Accept-Encoding', 'X-Ratelimit-Limit': '300', 'X-Ratelimit-Remaining': '294', 'X-Ratelimit-Reset': '1694010784', 'X-Request-Id': '7v3eatma04000wbjxvyg'}
RESPONSE PAYLOAD:
{'subject': 'acct:realaravinth@batsense.net', 'aliases': ['https://gts.batsense.net/users/realaravinth', 'https://gts.batsense.net/@realaravinth'], 'links': [{'rel': 'http://webfinger.net/rel/profile-page', 'type': 'text/html', 'href': 'https://gts.batsense.net/@realaravinth'}, {'rel': 'self', 'type': 'application/activity+json', 'href': 'https://gts.batsense.net/users/realaravinth'}]}
2023-09-06 19:59:26,966 - webfinger - INFO - [SUCCESS] WebFinger query response is HTTP 200
2023-09-06 19:59:26,966 - webfinger - INFO - [SUCCESS] WebFinger response has 'subject', 'aliases' and 'links' parameters'
2023-09-06 19:59:26,966 - webfinger - DEBUG - 'rel==http://webfinger.net/rel/profile-page' is present in 'links' WebFinger response parameter
2023-09-06 19:59:26,966 - webfinger - INFO - [SUCESS] rel==self passed schema validation
2023-09-06 19:59:26,966 - webfinger - INFO - [SUCESS] rel==profile-page passed schema validation
2023-09-06 19:59:26,966 - webfinger - INFO - [SUCESS] 'links' object passed validation
2023-09-06 19:59:26,966 - webfinger - ERROR - Access-Control-Allow-Origin header should be '*' to allow any domain to access the resource with CORS. Please see https://www.rfc-editor.org/rfc/rfc7033.html#section-5
===============
Partial success. 4 out of 5 tests passed
Summary:
Successful tests:
[OK] test_main_params
[OK] test_links
[OK] test_subject
Failed tests:
[FAIL] test_access_control_allow_origin failed with error:
Access-Control-Allow-Origin header should be '*' to allow any domain to access the resource with CORS. Please see https://www.rfc-editor.org/rfc/rfc7033.html#section-5