def test_timeout(self):
     self.expected.update(dict(
         timeout='10'))
     ctx_proxy.main(['--timeout', self.expected.get('timeout')])
     self.expected.update(dict(
         timeout='15'))
     ctx_proxy.main(['-t', self.expected.get('timeout')])
Esempio n. 2
0
 def test_mixed_order(self):
     self.expected.update(
         dict(args=['1', '2', '3'],
              timeout='20',
              socket_url='mixed_socket_url'))
     ctx_proxy.main(
         ['-t', self.expected.get('timeout')] +
         ['--socket-url', self.expected.get('socket_url')] +
         self.expected.get('args'))
     ctx_proxy.main(
         ['-t', self.expected.get('timeout')] + self.expected.get('args') +
         ['--socket-url', self.expected.get('socket_url')])
     ctx_proxy.main(
         self.expected.get('args') +
         ['-t', self.expected.get('timeout')] +
         ['--socket-url', self.expected.get('socket_url')])
 def test_mixed_order(self):
     self.expected.update(dict(
         args=['1', '2', '3'],
         timeout='20',
         socket_url='mixed_socket_url'))
     ctx_proxy.main(
         ['-t', self.expected.get('timeout')] +
         ['--socket-url', self.expected.get('socket_url')] +
         self.expected.get('args'))
     ctx_proxy.main(
         ['-t', self.expected.get('timeout')] +
         self.expected.get('args') +
         ['--socket-url', self.expected.get('socket_url')])
     ctx_proxy.main(
         self.expected.get('args') +
         ['-t', self.expected.get('timeout')] +
         ['--socket-url', self.expected.get('socket_url')])
 def run(args, expected):
     output = StringIO()
     sys.stdout = output
     ctx_proxy.main(args)
     self.assertEqual(output.getvalue(), expected)
 def test_json_arg_prefix(self):
     args = ['_1', '@1']
     expected_args = [1, '@1']
     self.expected.update(dict(
         args=expected_args))
     ctx_proxy.main(args + ['--json-arg-prefix', '_'])
 def test_json_args(self):
     args = ['@1', '@[1,2,3]', '@{"key":"value"}']
     expected_args = [1, [1, 2, 3], {'key': 'value'}]
     self.expected.update(dict(
         args=expected_args))
     ctx_proxy.main(args)
 def test_args(self):
     self.expected.update(dict(
         args=['1', '2', '3']))
     ctx_proxy.main(self.expected.get('args'))
 def test_socket_url_env(self):
     expected_socket_url = 'env_sock_url'
     os.environ['CTX_SOCKET_URL'] = expected_socket_url
     self.expected.update(dict(
         socket_url=expected_socket_url))
     ctx_proxy.main([])
 def test_socket_url_arg(self):
     self.expected.update(dict(
         socket_url='sock_url'))
     ctx_proxy.main(['--socket-url', self.expected.get('socket_url')])
Esempio n. 10
0
 def run(args, expected):
     output = StringIO()
     sys.stdout = output
     ctx_proxy.main(args)
     self.assertEqual(output.getvalue(), expected)
Esempio n. 11
0
 def test_json_arg_prefix(self):
     args = ['_1', '@1']
     expected_args = [1, '@1']
     self.expected.update(dict(args=expected_args))
     ctx_proxy.main(args + ['--json-arg-prefix', '_'])
Esempio n. 12
0
 def test_json_args(self):
     args = ['@1', '@[1,2,3]', '@{"key":"value"}']
     expected_args = [1, [1, 2, 3], {'key': 'value'}]
     self.expected.update(dict(args=expected_args))
     ctx_proxy.main(args)
Esempio n. 13
0
 def test_timeout(self):
     self.expected.update(dict(timeout='10'))
     ctx_proxy.main(['--timeout', self.expected.get('timeout')])
     self.expected.update(dict(timeout='15'))
     ctx_proxy.main(['-t', self.expected.get('timeout')])
Esempio n. 14
0
 def test_args(self):
     self.expected.update(dict(args=['1', '2', '3']))
     ctx_proxy.main(self.expected.get('args'))
Esempio n. 15
0
 def test_socket_url_env(self):
     expected_socket_url = 'env_sock_url'
     os.environ['CTX_SOCKET_URL'] = expected_socket_url
     self.expected.update(dict(socket_url=expected_socket_url))
     ctx_proxy.main([])
Esempio n. 16
0
 def test_socket_url_arg(self):
     self.expected.update(dict(socket_url='sock_url'))
     ctx_proxy.main(['--socket-url', self.expected.get('socket_url')])