File: test_extension.py

package info (click to toggle)
mopidy 3.4.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,712 kB
  • sloc: python: 16,672; sh: 159; makefile: 127
file content (35 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from mopidy import config as config_lib
from mopidy.http import Extension


def test_get_default_config():
    ext = Extension()

    config = ext.get_default_config()

    assert "[http]" in config
    assert "enabled = true" in config


def test_get_config_schema():
    ext = Extension()

    schema = ext.get_config_schema()

    assert "enabled" in schema
    assert "hostname" in schema
    assert "port" in schema
    assert "zeroconf" in schema
    assert "allowed_origins" in schema
    assert "csrf_protection" in schema
    assert "default_app" in schema


def test_default_config_is_valid():
    ext = Extension()

    config = ext.get_default_config()
    schema = ext.get_config_schema()
    _, errors = config_lib.load([], [schema], [config], [])

    assert errors.get("http") is None