def test_setup_no_module(self): with self.assertRaises(CliError) as context: get_operation_and_args('no.op', '') self.assertEqual( context.exception.message, 'No such module: no', )
def test_setup_no_op(self): with self.assertRaises(CliError) as context: get_operation_and_args('server.no', '') self.assertEqual( context.exception.message, 'No such operation: server.no', )
def test_setup_op_and_json_args(self): commands = ('server.user', '[["one", "two"], {"hello": "world"}]') assert get_operation_and_args(commands) == ( server.user, (['one', 'two'], {'hello': 'world'}), )
def test_setup_op_and_args(self): commands = ('server.user', 'one', 'two', 'hello=world') assert get_operation_and_args(commands) == ( server.user, (['one', 'two'], {'hello': 'world'}), )
def test_legacy_setup_op_and_json_args(self): op_string = 'server.user' args_string = '[["one", "two"], {"hello": "world"}]' assert get_operation_and_args((op_string, args_string)) == ( server.user, (['one', 'two'], { 'hello': 'world' }), )
def test_legacy_setup_op_and_args_list(self): op_string = 'server.user' args_string = '[one,two],hello=world' assert get_operation_and_args((op_string, args_string)) == ( server.user, ([['one', 'two']], { 'hello': 'world' }), )
def test_legacy_setup_op_and_args(self): op_string = 'server.user' args_string = 'one,two,hello=world' self.assertEqual( get_operation_and_args((op_string, args_string)), ( server.user, (['one', 'two'], {'hello': 'world'}), ), )
def test_setup_op_and_json_args(self): op_string = 'server.user' args_string = '[["one", "two"], {"hello": "world"}]' self.assertEqual( get_operation_and_args(op_string, args_string), ( server.user, (['one', 'two'], { 'hello': 'world' }), ), )
def test_setup_op_and_args_list(self): op_string = 'server.user' args_string = '[one,two],hello=world' self.assertEqual( get_operation_and_args(op_string, args_string), ( server.user, ([['one', 'two']], { 'hello': 'world' }), ), )
def test_user_op(user_sys_path): commands = ('test_ops.dummy_op', 'arg1', 'arg2') res = get_operation_and_args(commands) import test_ops assert res == (test_ops.dummy_op, (['arg1', 'arg2'], {}))