示例#1
0
    def test_parse_comment(self):
        input_lines = '''
[app:main]
#ckan.site_title = CKAN
'''.split('\n')

        out = config_tool.parse_config(input_lines)

        assert str(out) == "{"\
            "'app:main-ckan.site_title': <Option [app:main] #ckan.site_title = CKAN>" \
            "}"
示例#2
0
    def test_parse_basic(self):
        input_lines = '''
[app:main]
ckan.site_title = CKAN
'''.split('\n')

        out = config_tool.parse_config(input_lines)

        # do string comparison to avoid needing an __eq__method on Option
        assert str(out) == "{"\
            "'app:main-ckan.site_title': <Option [app:main] ckan.site_title = CKAN>" \
            "}"
    def test_parse_comment(self):
        input_lines = """
[app:main]
#ckan.site_title = CKAN
""".split("\n")

        out = config_tool.parse_config(input_lines)

        assert (
            str(out) == "{"
            "'app:main-ckan.site_title': <Option [app:main] #ckan.site_title = CKAN>"
            "}")
    def test_parse_basic(self):
        input_lines = """
[app:main]
ckan.site_title = CKAN
""".split("\n")

        out = config_tool.parse_config(input_lines)

        # do string comparison to avoid needing an __eq__method on Option
        assert (
            str(out) == "{"
            "'app:main-ckan.site_title': <Option [app:main] ckan.site_title = CKAN>"
            "}")
示例#5
0
    def test_parse_sections(self):
        input_lines = '''
[logger]
keys = root, ckan, ckanext
level = WARNING

[app:main]
ckan.site_title = CKAN
'''.split('\n')

        out = config_tool.parse_config(input_lines)

        assert str(out) == "{"\
            "'logger-keys': <Option [logger] keys = root, ckan, ckanext>, " \
            "'app:main-ckan.site_title': <Option [app:main] ckan.site_title = CKAN>, " \
            "'logger-level': <Option [logger] level = WARNING>" \
            "}"
    def test_parse_sections(self):
        input_lines = """
[logger]
keys = root, ckan, ckanext
level = WARNING

[app:main]
ckan.site_title = CKAN
""".split("\n")

        out = sorted(config_tool.parse_config(input_lines).items())

        assert (
            str(out) == "["
            "('app:main-ckan.site_title', <Option [app:main] ckan.site_title = CKAN>), "
            "('logger-keys', <Option [logger] keys = root, ckan, ckanext>), "
            "('logger-level', <Option [logger] level = WARNING>)"
            "]")
示例#7
0
    def test_parse_sections(self):
        input_lines = """
[logger]
keys = root, ckan, ckanext
level = WARNING

[app:main]
ckan.site_title = CKAN
""".split(
            "\n"
        )

        out = config_tool.parse_config(input_lines)

        assert (
            str(out) == "{"
            "'logger-keys': <Option [logger] keys = root, ckan, ckanext>, "
            "'app:main-ckan.site_title': <Option [app:main] ckan.site_title = CKAN>, "
            "'logger-level': <Option [logger] level = WARNING>"
            "}"
        )