Esempio n. 1
0
def test_update_config(config):
    default = Config()

    tags = [
        {
            "name":
            "mouse",
            "description":
            "first create a house using the house API then you can create a mouse",
        },
        {
            "name": "house",
            "description": "create somewhere for people and mice to live",
        },
    ]

    config.update(
        title="demo",
        version="latest",
        info={"description": "describe my api"},
        tags=tags,
    )
    assert config.DOMAIN is None
    assert config.FILENAME == default.FILENAME
    assert config.TITLE == "demo"
    assert config.VERSION == "latest"
    assert config.INFO["description"] == "describe my api"
    assert config.TAGS[1]["name"] == "house"

    config.update(unknown="missing")
    with pytest.raises(AttributeError):
        assert config.unknown
Esempio n. 2
0
def test_spectree_init():
    spec = SpecTree(path='docs')
    conf = Config()

    assert spec.config.TITLE == conf.TITLE
    assert spec.config.PATH == 'docs'

    with pytest.raises(NotImplementedError):
        SpecTree(app=conf)
Esempio n. 3
0
def test_update_config(config):
    default = Config()

    config.update(title="demo", version="latest")
    assert config.DOMAIN is None
    assert config.FILENAME == default.FILENAME
    assert config.TITLE == "demo"
    assert config.VERSION == "latest"

    config.update(unknown="missing")
    with pytest.raises(AttributeError):
        assert config.unknown
Esempio n. 4
0
def test_update_config(config):
    default = Config()

    config.update(title='demo', version='latest')
    assert config.DOMAIN is None
    assert config.FILENAME == default.FILENAME
    assert config.TITLE == 'demo'
    assert config.VERSION == 'latest'

    config.update(unknown='missing')
    with pytest.raises(AttributeError):
        assert config.unknown
Esempio n. 5
0
def config():
    return Config()
Esempio n. 6
0
def test_spectree_init():
    spec = SpecTree(path="docs")
    conf = Config()

    assert spec.config.TITLE == conf.TITLE
    assert spec.config.PATH == "docs"