示例#1
0
    def test_cli(self, tmpdir):
        """
        Test that when passing in certain arguments from commandline they
        are handled correctly by docopt and correct args structure is returned.
        """
        input = tmpdir.join("cli/1a.yaml")
        schema_file = tmpdir.join("cli/1b.yaml")

        sys.argv = [
            'scripts/pykwalify', '-d',
            str(input), '-s',
            str(schema_file), '-v'
        ]

        expected = {
            '--data-file': str(input),
            '--schema-file': [str(schema_file)],
            '--quiet': False,
            '--verbose': 1,
        }

        cli_args = cli.parse_cli()

        for k, v in expected.items():
            assert k in cli_args
            assert cli_args[k] == expected[k]
示例#2
0
    def test_cli(self, tmpdir):
        """
        Test that when passing in certain arguments from commandline they
        are handled correctly by docopt and correct args structure is returned.
        """
        input = tmpdir.join("cli/1a.yaml")
        schema_file = tmpdir.join("cli/1b.yaml")

        sys.argv = [
            'scripts/pykwalify',
            '-d', str(input),
            '-s', str(schema_file),
            '-v'
        ]

        expected = {
            '--data-file': str(input),
            '--schema-file': [str(schema_file)],
            '--quiet': False,
            '--verbose': 1,
        }

        cli_args = cli.parse_cli()

        for k, v in expected.items():
            assert k in cli_args
            assert cli_args[k] == expected[k]
示例#3
0
    def test_run_cli(self):
        """
        This should test that running the cli still works as expected
        """
        input = self.f("cli/1a.yaml")
        schema_file = self.f("cli/1b.yaml")

        sys.argv = [
            'scripts/pykwalify',
            '-d', str(input),
            '-s', str(schema_file),
        ]

        cli_args = cli.parse_cli()
        c = cli.run(cli_args)
        assert c.validation_errors == []
示例#4
0
    def test_run_cli(self):
        """
        This should test that running the cli still works as expected
        """
        input = self.f("cli/1a.yaml")
        schema_file = self.f("cli/1b.yaml")

        sys.argv = [
            'scripts/pykwalify',
            '-d',
            str(input),
            '-s',
            str(schema_file),
        ]

        cli_args = cli.parse_cli()
        c = cli.run(cli_args)
        assert c.validation_errors == []