2015-07-24 23:50:22 +03:00
|
|
|
import pytest
|
|
|
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
2015-07-30 18:28:20 +03:00
|
|
|
refuse_with_confirmation, select_command_with_arrows
|
2015-07-24 23:50:22 +03:00
|
|
|
|
2016-10-06 11:12:36 -04:00
|
|
|
containers = (('thefuck/python3-tcsh',
|
|
|
|
u'''FROM python:3
|
2015-09-06 00:56:18 +03:00
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -yy tcsh''',
|
|
|
|
u'tcsh'),
|
2016-10-06 11:12:36 -04:00
|
|
|
('thefuck/python2-tcsh',
|
|
|
|
u'''FROM python:2
|
2015-09-06 00:56:18 +03:00
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -yy tcsh''',
|
|
|
|
u'tcsh'))
|
2015-07-24 23:50:22 +03:00
|
|
|
|
|
|
|
|
2015-07-29 16:30:32 +03:00
|
|
|
@pytest.fixture(params=containers)
|
2016-08-13 14:50:21 +03:00
|
|
|
def proc(request, spawnu, TIMEOUT):
|
2015-09-06 00:56:18 +03:00
|
|
|
proc = spawnu(*request.param)
|
2016-08-13 14:11:18 +03:00
|
|
|
proc.sendline(u'pip install /src')
|
2016-08-13 14:50:21 +03:00
|
|
|
assert proc.expect([TIMEOUT, u'Successfully installed'])
|
2015-07-29 16:30:32 +03:00
|
|
|
proc.sendline(u'tcsh')
|
2016-06-28 00:00:49 +03:00
|
|
|
proc.sendline(u'setenv PYTHONIOENCODING utf8')
|
2015-09-01 18:36:25 +03:00
|
|
|
proc.sendline(u'eval `thefuck --alias`')
|
2015-07-29 16:30:32 +03:00
|
|
|
return proc
|
|
|
|
|
|
|
|
|
2015-09-06 01:13:44 +03:00
|
|
|
@pytest.mark.functional
|
2015-09-06 00:56:18 +03:00
|
|
|
def test_with_confirmation(proc, TIMEOUT):
|
|
|
|
with_confirmation(proc, TIMEOUT)
|
2015-07-24 23:50:22 +03:00
|
|
|
|
|
|
|
|
2015-09-06 01:13:44 +03:00
|
|
|
@pytest.mark.functional
|
2015-09-06 00:56:18 +03:00
|
|
|
def test_select_command_with_arrows(proc, TIMEOUT):
|
|
|
|
select_command_with_arrows(proc, TIMEOUT)
|
2015-07-30 18:28:20 +03:00
|
|
|
|
|
|
|
|
2015-09-06 01:13:44 +03:00
|
|
|
@pytest.mark.functional
|
2015-09-06 00:56:18 +03:00
|
|
|
def test_refuse_with_confirmation(proc, TIMEOUT):
|
|
|
|
refuse_with_confirmation(proc, TIMEOUT)
|
2015-07-24 23:50:22 +03:00
|
|
|
|
|
|
|
|
2015-09-06 01:13:44 +03:00
|
|
|
@pytest.mark.functional
|
2015-09-06 00:56:18 +03:00
|
|
|
def test_without_confirmation(proc, TIMEOUT):
|
|
|
|
without_confirmation(proc, TIMEOUT)
|
2015-07-27 17:28:09 +03:00
|
|
|
|
|
|
|
# TODO: ensure that history changes.
|