Merge pull request #250 from michael-lazar/unittest_refresh_token
Disable unit tests from deleting refresh token.
This commit is contained in:
@@ -5,6 +5,7 @@ import os
|
||||
import curses
|
||||
import logging
|
||||
from functools import partial
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
import praw
|
||||
import pytest
|
||||
@@ -124,9 +125,18 @@ def refresh_token(request):
|
||||
|
||||
@pytest.yield_fixture()
|
||||
def config():
|
||||
with patch('rtv.config.Config.save_refresh_token'), \
|
||||
patch('rtv.config.Config.save_history'):
|
||||
yield Config()
|
||||
conf = Config()
|
||||
with mock.patch.object(conf, 'save_history'), \
|
||||
mock.patch.object(conf, 'delete_history'), \
|
||||
mock.patch.object(conf, 'save_refresh_token'), \
|
||||
mock.patch.object(conf, 'delete_refresh_token'):
|
||||
|
||||
def delete_refresh_token():
|
||||
# Skip the os.remove
|
||||
conf.refresh_token = None
|
||||
conf.delete_refresh_token.side_effect = delete_refresh_token
|
||||
|
||||
yield conf
|
||||
|
||||
|
||||
@pytest.yield_fixture()
|
||||
|
||||
@@ -223,6 +223,8 @@ def test_submission_edit(submission_page, terminal, refresh_token):
|
||||
submission_page.oauth.authorize()
|
||||
|
||||
# Try to edit the submission - wrong author
|
||||
data = submission_page.content.get(submission_page.nav.absolute_index)
|
||||
data['author'] = 'some other person'
|
||||
curses.flash.reset_mock()
|
||||
submission_page.controller.trigger('e')
|
||||
assert curses.flash.called
|
||||
|
||||
@@ -40,7 +40,7 @@ def test_subscription_page_construct(reddit, terminal, config, oauth,
|
||||
|
||||
# Header - Name
|
||||
name = reddit.user.name.encode('utf-8')
|
||||
window.addstr.assert_any_call(0, 59, name)
|
||||
assert name in [args[0][2] for args in window.addstr.call_args_list]
|
||||
|
||||
# Banner shouldn't be drawn
|
||||
menu = ('[1]hot '
|
||||
|
||||
Reference in New Issue
Block a user