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 curses
|
||||||
import logging
|
import logging
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
import praw
|
import praw
|
||||||
import pytest
|
import pytest
|
||||||
@@ -124,9 +125,18 @@ def refresh_token(request):
|
|||||||
|
|
||||||
@pytest.yield_fixture()
|
@pytest.yield_fixture()
|
||||||
def config():
|
def config():
|
||||||
with patch('rtv.config.Config.save_refresh_token'), \
|
conf = Config()
|
||||||
patch('rtv.config.Config.save_history'):
|
with mock.patch.object(conf, 'save_history'), \
|
||||||
yield Config()
|
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()
|
@pytest.yield_fixture()
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ def test_submission_edit(submission_page, terminal, refresh_token):
|
|||||||
submission_page.oauth.authorize()
|
submission_page.oauth.authorize()
|
||||||
|
|
||||||
# Try to edit the submission - wrong author
|
# 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()
|
curses.flash.reset_mock()
|
||||||
submission_page.controller.trigger('e')
|
submission_page.controller.trigger('e')
|
||||||
assert curses.flash.called
|
assert curses.flash.called
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def test_subscription_page_construct(reddit, terminal, config, oauth,
|
|||||||
|
|
||||||
# Header - Name
|
# Header - Name
|
||||||
name = reddit.user.name.encode('utf-8')
|
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
|
# Banner shouldn't be drawn
|
||||||
menu = ('[1]hot '
|
menu = ('[1]hot '
|
||||||
|
|||||||
Reference in New Issue
Block a user