Working on tests

This commit is contained in:
Michael Lazar
2017-09-13 02:04:58 -04:00
parent 8c22d742f2
commit 5908d932f0
2 changed files with 7 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ from vcr import VCR
from six.moves.urllib.parse import urlparse, parse_qs
from six.moves.BaseHTTPServer import HTTPServer
from rtv.oauth import OAuthHelper, OAuthHandler
from rtv.oauth import OAuthHelper, OAuthHandler, OAuthRateLimitHandler
from rtv.config import Config
from rtv.packages import praw
from rtv.terminal import Terminal
@@ -180,9 +180,12 @@ def reddit(vcr, request):
with vcr.use_cassette(cassette_name):
with patch('rtv.packages.praw.Reddit.get_access_information'):
handler = OAuthRateLimitHandler()
reddit = praw.Reddit(user_agent='rtv test suite',
decode_html_entities=False,
disable_update_check=True)
disable_update_check=True,
handler=handler)
# praw uses a global cache for requests, so we need to clear it
# before each unit test. Otherwise we may fail to generate new
# cassettes.