2015-07-24 08:04:49 +03:00
|
|
|
def with_confirmation(proc):
|
|
|
|
"""Ensures that command can be fixed when confirmation enabled."""
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline(u'echo "require_confirmation = True" > ~/.thefuck/settings.py')
|
2015-07-25 03:01:03 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'ehco test')
|
2015-07-24 08:04:49 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'fuck')
|
|
|
|
proc.expect(u'echo test')
|
|
|
|
proc.expect(u'enter')
|
|
|
|
proc.expect_exact(u'ctrl+c')
|
2015-07-24 08:04:49 +03:00
|
|
|
proc.send('\n')
|
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.expect(u'test')
|
2015-07-24 08:04:49 +03:00
|
|
|
|
|
|
|
|
2015-07-24 23:14:58 +03:00
|
|
|
def refuse_with_confirmation(proc):
|
|
|
|
"""Ensures that fix can be refused when confirmation enabled."""
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline(u'echo "require_confirmation = True" > ~/.thefuck/settings.py')
|
2015-07-25 03:01:03 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'ehco test')
|
2015-07-24 23:14:58 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'fuck')
|
|
|
|
proc.expect(u'echo test')
|
|
|
|
proc.expect(u'enter')
|
|
|
|
proc.expect_exact(u'ctrl+c')
|
2015-07-24 23:14:58 +03:00
|
|
|
proc.send('\003')
|
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.expect(u'Aborted')
|
2015-07-24 23:14:58 +03:00
|
|
|
|
|
|
|
|
2015-07-24 08:04:49 +03:00
|
|
|
def without_confirmation(proc):
|
|
|
|
"""Ensures that command can be fixed when confirmation disabled."""
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline(u'echo "require_confirmation = False" > ~/.thefuck/settings.py')
|
2015-07-25 03:01:03 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'ehco test')
|
2015-07-24 08:04:49 +03:00
|
|
|
|
2015-07-25 03:22:05 +03:00
|
|
|
proc.sendline(u'fuck')
|
|
|
|
proc.expect(u'echo test')
|
|
|
|
proc.expect(u'test')
|