Skip to content

Commit

Permalink
Break test suite to expose missing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Aug 10, 2016
1 parent d6fea90 commit 4698611
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions executor/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Automated tests for the `executor' module.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: July 9, 2016
# Last Change: August 10, 2016
# URL: https://executor.readthedocs.org

"""
Expand Down Expand Up @@ -172,10 +172,6 @@ def check_termination(self, method):
assert not cmd.is_running, "Child still running despite graceful termination request!"
assert timer.elapsed_time < 10, "It look too long to terminate the child!"

def test_argument_validation(self):
"""Make sure the external command constructor requires a command argument."""
self.assertRaises(TypeError, ExternalCommand)

def test_program_searching(self):
"""Make sure which() works as expected."""
assert which('python')
Expand Down Expand Up @@ -218,6 +214,22 @@ def test_shell_opt_out(self):
cmd.wait()
assert cmd.error_type is CommandNotFound

def test_commands_on_stdin(self):
"""Test that callers can opt in to shell evaluation for local commands given on standard input."""
random_string = uuid.uuid4().hex
output = execute(capture=True, shell=True, input='echo %s' % quote(random_string))
assert output == random_string

def test_remote_commands_on_stdin(self):
"""Test that callers can opt in to shell evaluation for remote commands given on standard input."""
random_string = uuid.uuid4().hex
with SSHServer() as server:
output = remote('127.0.0.1',
capture=True, shell=True,
input='echo %s' % quote(random_string),
**server.client_options)
assert output == random_string

def test_stdin(self):
"""Make sure standard input can be provided to external commands."""
assert execute('tr', 'a-z', 'A-Z', input='test', capture=True) == 'TEST'
Expand Down

0 comments on commit 4698611

Please sign in to comment.