Exemple #1
0
def test_database_party_names():
    db = load_db("tests/fixtures/data")
    assert db.party_names == {
        "a_party": "A Party",
        "b.party": "B Party",
        "s-party": "Structured Party",
    }
Exemple #2
0
def test_database_party_colors():
    db = load_db("tests/fixtures/data")
    assert db.party_colors == {
        "a_party": "#ff0000",
        "b.party": "#00ff00",
        "s-party": "#000000",
    }
Exemple #3
0
def client():
    db = load_db("tests/fixtures/data")
    app = create_app(db)
    with app.test_client() as client:
        yield client
Exemple #4
0
from wahlprogramme import create_app
from wahlprogramme.database import load_db

# load database
db = load_db("data/", txt=False)
app = create_app(db)
Exemple #5
0
def test_database_meta_data():
    db = load_db("tests/fixtures/data")
    assert "a_party" in db.meta.parties
    assert db.meta.parties["a_party"].color == "#ff0000"
    assert db.meta.parties["a_party"].name == "A Party"
Exemple #6
0
def test_database_parties():
    db = load_db("tests/fixtures/data")
    assert "a_party" in db.parties
    assert "b.party" in db.parties
Exemple #7
0
def test_database_years():
    db = load_db("tests/fixtures/data")
    assert db.years == ["1000", "1001"]
Exemple #8
0
def test_load_db_only_xml():
    db = load_db("tests/fixtures/data", txt=False)
    assert type(db) == Database
    assert type(db.get("1001")) == Year
    assert db.get("1001").get("a_party") is None
    assert type(db.get("1001").get("s-party")) == StructuredText
Exemple #9
0
def test_load_db():
    db = load_db("tests/fixtures/data")
    assert type(db) == Database
    assert type(db.get("1000")) == Year
    assert type(db.get("1001")) == Year