Exemplo n.º 1
0
def test_cli_parsing():
    test_patterns = (
        (['start'], {'start': True}, []),
        (['stop'], {'stop': True}, []),
        (['shell'], {'shell': True}, []),
        (['manage', 'shell'], {'manage': True, 'COMMAND': 'shell'}, []),
        (['manage', 'help'], {'manage': True, 'COMMAND': 'help'}, []),
        (['manage', 'blah'], {'manage': True, 'COMMAND': 'blah'}, []),
        (
            ['manage', 'blah', '--debug', '--', '--django-arg'],
            {'manage': True, 'COMMAND': 'blah', '--debug': True},
            ['--django-arg']
        ),
        (
            ['manage', 'blah', '--django-arg'],
            {'manage': True, 'COMMAND': 'blah'},
            ['--django-arg']
        ),
    )

    for p, docopt_expected, django_expected in test_patterns:
        docopt, django = cli.parse_args(p)

        for k, v in docopt_expected.items():
            assert docopt[k] == v

        assert django == django_expected
Exemplo n.º 2
0
def test_cli_parsing():
    test_patterns = (
        (['start'], {'start': True}, []),
        (['stop'], {'stop': True}, []),
        (['shell'], {'shell': True}, []),
        (['manage', 'shell'], {'manage': True, 'COMMAND': 'shell'}, []),
        (['manage', 'help'], {'manage': True, 'COMMAND': 'help'}, []),
        (['manage', 'blah'], {'manage': True, 'COMMAND': 'blah'}, []),
        (
            ['manage', 'blah', '--debug', '--', '--django-arg'],
            {'manage': True, 'COMMAND': 'blah', '--debug': True},
            ['--django-arg']
        ),
        (
            ['manage', 'blah', '--django-arg'],
            {'manage': True, 'COMMAND': 'blah'},
            ['--django-arg']
        ),
    )

    for p, docopt_expected, django_expected in test_patterns:
        docopt, django = cli.parse_args(p)

        for k, v in docopt_expected.items():
            assert docopt[k] == v

        assert django == django_expected
Exemplo n.º 3
0
def test_cli_parsing():
    test_patterns = (
        (["start"], {
            "start": True
        }, []),
        (["stop"], {
            "stop": True
        }, []),
        (["shell"], {
            "shell": True
        }, []),
        (["manage", "shell"], {
            "manage": True,
            "COMMAND": "shell"
        }, []),
        (["manage", "help"], {
            "manage": True,
            "COMMAND": "help"
        }, []),
        (["manage", "blah"], {
            "manage": True,
            "COMMAND": "blah"
        }, []),
        (
            ["manage", "blah", "--debug", "--", "--django-arg"],
            {
                "manage": True,
                "COMMAND": "blah",
                "--debug": True
            },
            ["--django-arg"],
        ),
        (
            ["manage", "blah", "--django-arg"],
            {
                "manage": True,
                "COMMAND": "blah"
            },
            ["--django-arg"],
        ),
    )

    for p, docopt_expected, django_expected in test_patterns:
        docopt, django = cli.parse_args(p)

        for k, v in docopt_expected.items():
            assert docopt[k] == v

        assert django == django_expected