コード例 #1
0
ファイル: test_cli.py プロジェクト: grantstephens/pyinfra
    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',
        )
コード例 #2
0
ファイル: test_cli.py プロジェクト: grantstephens/pyinfra
    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',
        )
コード例 #3
0
ファイル: test_cli_util.py プロジェクト: zevs00807/pyinfra
    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'}),
        )
コード例 #4
0
ファイル: test_cli_util.py プロジェクト: zevs00807/pyinfra
    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'}),
        )
コード例 #5
0
    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'
            }),
        )
コード例 #6
0
    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'
            }),
        )
コード例 #7
0
ファイル: test_cli_legacy.py プロジェクト: ryanwersal/pyinfra
    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'}),
            ),
        )
コード例 #8
0
ファイル: test_cli.py プロジェクト: grantstephens/pyinfra
    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'
                }),
            ),
        )
コード例 #9
0
ファイル: test_cli.py プロジェクト: grantstephens/pyinfra
    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'
                }),
            ),
        )
コード例 #10
0
ファイル: test_cli_util.py プロジェクト: a-domingu/tbcnn
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'], {}))