Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

9
Unit tests for praw?
Post Flair (click to view more posts with a particular flair)
Post Body

Hi! Does anyone happen to have a solution for mocking HTTP requests in unit tests for praw?

Context: I have a bot that's been running the same code for a solid 4 years. Let's just say I was a much worse programmer 4 years ago. I want to refactor to make it easier to configure via wikis, etc. and I'm scared I'm going to mess it up. Doubly so because the motivation for refactoring is to release it and/or deploy to more subreddits.

Would love to have some unit tests as guardrails when refactoring. I'm not a web dev, so I only have a sketchy concept of mocking (and might not have the right language to talk about this stuff), but I'm experienced with python in a data science-like context. Or is this question more general than just praw and should I be asking elsewhere?

Looking at betamax -- has anyone used this with more recent versions of praw?

Thanks so much for any pointers you can give.

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
48,017
Link Karma
6,197
Comment Karma
41,518
Profile updated: 5 days ago
Posts updated: 7 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago