Skip to content

Commit

Permalink
Merge pull request #7 from tomdottom/fix-test-runner
Browse files Browse the repository at this point in the history
Fixed return value of runtests.py and correct failing cli tests
  • Loading branch information
andreif authored May 25, 2018
2 parents 7e6154a + f2cc54b commit b79b267
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def main():
loader = unittest.TestLoader()
suite = loader.discover('tests')
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(1 if result.errors else 0)
sys.exit(not result.wasSuccessful())


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions tests/test_curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
class CurlTests(unittest.TestCase):
def test_cli(self):
with server():
self.assertTrue(cli('127.0.0.1', 'host.name/'))
self.assertFalse(cli('127.0.0.1', 'host.name/'))

def test_cli_nok(self):
with server(status=300):
self.assertFalse(cli('127.0.0.1:3030', '--timeout', '10'))
self.assertTrue(cli('127.0.0.1:3030', '--timeout', '10'))

def test_file_socket(self):
fname = '/tmp/unix-socket'

with server(addr=fname, params=(socket.AF_UNIX, socket.SOCK_STREAM)):
self.assertTrue(cli(fname))
self.assertFalse(cli(fname))

def test_headers(self):
with server(callback=lambda x: self.assertIn(b'localhost', x)):
self.assertTrue(cli('127.0.0.1:3030', '-H', 'Host: localhost'))
self.assertFalse(cli('127.0.0.1:3030', '-H', 'Host: localhost'))

0 comments on commit b79b267

Please sign in to comment.