2015-08-25 13:47:30 +03:00
|
|
|
import pytest
|
2015-09-08 15:24:49 +03:00
|
|
|
from thefuck.utils import get_installation_info
|
2015-09-06 00:56:18 +03:00
|
|
|
|
|
|
|
envs = ((u'bash', 'thefuck/ubuntu-bash', u'''
|
2015-08-25 13:47:30 +03:00
|
|
|
FROM ubuntu:latest
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -yy bash
|
2015-09-06 00:56:18 +03:00
|
|
|
'''), (u'bash', 'thefuck/generic-bash', u'''
|
2015-08-25 13:47:30 +03:00
|
|
|
FROM fedora:latest
|
2015-09-05 11:54:59 +03:00
|
|
|
RUN dnf install -yy python-devel sudo wget gcc
|
2015-08-25 13:47:30 +03:00
|
|
|
'''))
|
|
|
|
|
|
|
|
|
2015-09-06 01:13:44 +03:00
|
|
|
@pytest.mark.functional
|
2015-09-06 00:56:18 +03:00
|
|
|
@pytest.mark.skip_without_docker
|
2015-08-25 13:47:30 +03:00
|
|
|
@pytest.mark.parametrize('shell, tag, dockerfile', envs)
|
2015-09-06 00:56:18 +03:00
|
|
|
def test_installation(spawnu, shell, TIMEOUT, tag, dockerfile):
|
|
|
|
proc = spawnu(tag, dockerfile, shell)
|
2015-08-25 13:47:30 +03:00
|
|
|
proc.sendline(u'cat /src/install.sh | sh - && $0')
|
|
|
|
proc.sendline(u'thefuck --version')
|
2015-09-08 15:24:49 +03:00
|
|
|
version = get_installation_info().version
|
|
|
|
assert proc.expect([TIMEOUT, u'thefuck {}'.format(version)],
|
2015-09-06 00:56:18 +03:00
|
|
|
timeout=600)
|
2015-08-25 13:47:30 +03:00
|
|
|
proc.sendline(u'fuck')
|
|
|
|
assert proc.expect([TIMEOUT, u'No fucks given'])
|