-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added e2e tests for CORS reddit api #330
base: main
Are you sure you want to change the base?
Conversation
@reingart @NicolasSandoval, the previous attempt at adding e2e tests did not explicitly check for errors, I check the status code to check if the api is working properly handling this error earlier. |
Published to http://pyar.github.io/PyZombis/330/index.html |
tests/test_TWP45.py
Outdated
@@ -18,7 +29,6 @@ def test_l45_1(page): | |||
# Test the src attribute from image matches the Facebook URL | |||
assert img_src == "https://graph.facebook.com/ACDC/picture?type=large" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a newline here to match with the convention (2 newlines after each test).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out, fixed!
|
once check and do necessary changes |
tests/test_TWP45.py
Outdated
def test_l45_2(): | ||
"""Tests fetching data from the provided URL""" | ||
# Send a GET request to the URL | ||
url = "https://cors.bridged.cc/http://www.reddit.com/r/Python/.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the tests are failing due to cors in my opinion.
as #320 use same reddit API link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Sujith, updated. This will save time.
@NicolasSandoval, the CORS error now is fixed with required tests keeping in mind the suggestions by @sujith-rek. Due the way GitHub handles running the tests the api is returning a 403 error but the code is running fine locally and the test is working as expected. The test is working as expected and only fails due to how github handles their testing workflow. |
Published to http://pyar.github.io/PyZombis/330/index.html |
Published to http://pyar.github.io/PyZombis/330/index.html |
@abadoni5 Can you try with another "User-Agent". Try this instead: |
Published to http://pyar.github.io/PyZombis/330/index.html |
@NicolasSandoval added the new header, tests on github still fail. The test still works as expected locally. Let me know if you want any changes. |
Published to http://pyar.github.io/PyZombis/330/index.html |
Published to http://pyar.github.io/PyZombis/330/index.html |
Summary
closes #213, the original lessons used CORS, which failed the tests, since in pr #320 we are using new api (api.reddit.com) I have fixed it.
Checklist
Screenshots