Commit e0d9a42e authored by godog's avatar godog

fix tests

parent 92f665c0
...@@ -11,7 +11,7 @@ class PopenStub(object): ...@@ -11,7 +11,7 @@ class PopenStub(object):
self.stdout = stdout self.stdout = stdout
self.returncode = returncode self.returncode = returncode
def communicate(self): def communicate(self, stdin=None):
return self.stdout, 'unused' return self.stdout, 'unused'
...@@ -27,7 +27,7 @@ class OpensslWrapTest(unittest.TestCase): ...@@ -27,7 +27,7 @@ class OpensslWrapTest(unittest.TestCase):
def test_run(self): def test_run(self):
self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True) self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True)
pipe_stub = PopenStub(stdout='output') pipe_stub = PopenStub(stdout='output')
subprocess.Popen(['openssl', 'test'], stdout=subprocess.PIPE, env=mox.IsA(dict) subprocess.Popen(['/usr/bin/openssl', 'test'], stdout=subprocess.PIPE, env=mox.IsA(dict)
).AndReturn(pipe_stub) ).AndReturn(pipe_stub)
self.mox.ReplayAll() self.mox.ReplayAll()
result = openssl_wrap.run('test') result = openssl_wrap.run('test')
...@@ -36,7 +36,7 @@ class OpensslWrapTest(unittest.TestCase): ...@@ -36,7 +36,7 @@ class OpensslWrapTest(unittest.TestCase):
def test_run_fails(self): def test_run_fails(self):
self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True) self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True)
pipe_stub = PopenStub(returncode=1) pipe_stub = PopenStub(returncode=1)
subprocess.Popen(['openssl', 'test'], stdout=subprocess.PIPE, env=mox.IsA(dict) subprocess.Popen(['/usr/bin/openssl', 'test'], stdout=subprocess.PIPE, env=mox.IsA(dict)
).AndReturn(pipe_stub) ).AndReturn(pipe_stub)
self.mox.ReplayAll() self.mox.ReplayAll()
def r(): def r():
...@@ -46,10 +46,10 @@ class OpensslWrapTest(unittest.TestCase): ...@@ -46,10 +46,10 @@ class OpensslWrapTest(unittest.TestCase):
def test_run_with_config(self): def test_run_with_config(self):
self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True) self.mox.StubOutWithMock(subprocess, 'Popen', use_mock_anything=True)
pipe_stub = PopenStub(stdout='output') pipe_stub = PopenStub(stdout='output')
subprocess.Popen(['openssl', 'test', '-config', 'conf', '-batch', 'arg'], subprocess.Popen(['/usr/bin/openssl', 'test', '-config', 'conf', '-batch', 'arg'],
stdout=subprocess.PIPE, env=mox.IsA(dict)).AndReturn(pipe_stub) stdout=subprocess.PIPE, env=mox.IsA(dict)).AndReturn(pipe_stub)
self.mox.ReplayAll() self.mox.ReplayAll()
result = openssl_wrap.run_with_config('.', 'conf', 'test', 'arg') result = openssl_wrap.run_with_config('.', 'conf', None, 'test', 'arg')
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment