Skip to content

Fix api.py logic for corrupt cookie jar and added test cases for the same#1085

Open
arnchlmcodes wants to merge 3 commits intoopenzim:mainfrom
arnchlmcodes:fixes-issue-#443
Open

Fix api.py logic for corrupt cookie jar and added test cases for the same#1085
arnchlmcodes wants to merge 3 commits intoopenzim:mainfrom
arnchlmcodes:fixes-issue-#443

Conversation

@arnchlmcodes
Copy link
Copy Markdown
Contributor

@arnchlmcodes arnchlmcodes commented Feb 24, 2026

Added a try/except so if the cookie file is broken or corrupted, it deletes it so the program can start fresh.

also added two tests in api_test.py, one to verify that the error handling works and the file gets deleted if it's corrupt and the other test to verify the recovery works and the bot continues and logs in.

ran the ci pipeline locally and made sure everything works.

closes #443

Copy link
Copy Markdown
Member

@audiodude audiodude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow sorry, this fell off my radar. Sorry about that. The code looks good but I'm worried about the tests.

@arnchlmcodes
Copy link
Copy Markdown
Contributor Author

Could you please tell me what concerns you have regarding the tests, happy to address it right away,
Is it that the new test cases are almost similar, I split them into two separate tests to keep each test focused on one thing, one for the deletion and one for the login recovery, but I can merge them if you'd prefer that.

Comment thread wp1/api_test.py
Comment thread wp1/api_test.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle the case when the cookiejar become corrupted

2 participants