feat: add demo logs

This commit is contained in:
Aravinth Manivannan 2023-09-06 20:01:00 +05:30
parent 40dd327046
commit b0bfe003c9
Signed by: realaravinth
GPG key ID: F8F50389936984FF

103
README.md
View file

@ -1,5 +1,11 @@
# WebFinger tests for ForgeFlux/ftest # WebFinger tests for ForgeFlux/ftest
## TODO
- [ ] Write code to upload to ftest server
- [ ] Package Docker container
- [ ] Upload to Docker Hub
## Environment Variables ## Environment Variables
Please see [`.env_sample`](./.env_sample) Please see [`.env_sample`](./.env_sample)
@ -18,8 +24,97 @@ source .env
python run.py python run.py
``` ```
## TODO ## Demo
- [ ] Write code to upload to ftest server ### Successful run:
- [ ] Package Docker container
- [ ] Upload to Docker Hub <details>
<summary>Please open to see logs</summary>
```bash
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
```
</details>
### Failed run:
<details>
<summary>Please open to see logs</summary>
```bash
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
```
</details>