コード例 #1
0
def test_beobachter_route():
    app = create_app()

    sensor = asyncio.get_event_loop().run_until_complete(create_sensor())
    sensor2 = asyncio.get_event_loop().run_until_complete(create_sensor())

    route_test(
        app, get_admin_headers(), get_personal_headers(), {
            'sensor': {
                'dev_eui': sensor["dev_eui"].value
            },
            'name': 'Temperatur Beobachter',
            'wertName': 'temperur',
            'ausloeserWert': 18,
            'art': BeobachterArt.RICHTWERT_DARUNTER.value
        }, {
            'sensor': {
                'dev_eui': sensor2["dev_eui"].value
            },
            'name': 'Temperatur Beobachter Update',
            'wertName': 'temperatur',
            'ausloeserWert': 26,
            'art': BeobachterArt.RICHTWERT_DARUEBER.value
        }, ['sensor.dev_eui', 'name', 'wertName', 'ausloeserWert', 'art'],
        'id', '/beobachter')
コード例 #2
0
ファイル: test_sensoren_route.py プロジェクト: nilsegger/ipa
def test_sensoren_route():
    app = create_app()
    raum = asyncio.get_event_loop().run_until_complete(create_raum())
    raum2 = asyncio.get_event_loop().run_until_complete(create_raum())

    route_test(app, get_admin_headers(), get_personal_headers(),
               {'dev_eui': ''.join(random.choice("abcdefghijklmnopqrstuvwxyz") for _ in range(16)), 'name': 'Sensor 1', 'art': SensorArt.ADEUNIS_RF.value, 'raum': {'id': raum["id"].value}},
               {'name': 'Sensor 1.0', 'art': SensorArt.ELSYS_ERS_CO2.value, 'raum': {'id': raum2["id"].value}},
               ['name', 'art', 'raum.id'], 'dev_eui', '/sensoren')
コード例 #3
0
def test_stockwerke_list():
    # Falls es andere Daten in der Datenbank hat so ist dies unmöglich zum testen.
    app = create_app()

    for _ in range(3):
        asyncio.get_event_loop().run_until_complete(create_stockwerk())

    with TestClient(app) as client:
        response = client.get('/stockwerke', headers=get_admin_headers())
        assert response.status_code == 200
コード例 #4
0
ファイル: test_personal_route.py プロジェクト: nilsegger/ipa
def test_personal_form():
    app = create_app()
    route_test(
        app, get_admin_headers(), get_personal_headers(), {
            'name': 'Hello World!',
            'benutzername': '*****@*****.**',
            'passwort': '123456',
            'rolle': Roles.PERSONAL.value
        }, {
            'name': 'Hello BBB!',
            'benutzername': '*****@*****.**',
            'passwort': '654321',
            'rolle': Roles.ADMIN.value
        }, ['name', 'benutzername', 'rolle'], 'uuid', '/personal')
コード例 #5
0
def test_raeume_route():
    app = create_app()
    stockwerk = asyncio.get_event_loop().run_until_complete(create_stockwerk())
    stockwerk2 = asyncio.get_event_loop().run_until_complete(
        create_stockwerk())

    route_test(app, get_admin_headers(), get_personal_headers(), {
        'name': '512',
        'stockwerk': {
            'id': stockwerk["id"].value
        }
    }, {
        'name': '502',
        'stockwerk': {
            'id': stockwerk2["id"].value
        }
    }, ['name', 'stockwerk.id'], 'id', '/raeume')
コード例 #6
0
ファイル: test_meldungen_route.py プロジェクト: nilsegger/ipa
def test_meldungen_route():
    app = create_app()
    sensor = asyncio.get_event_loop().run_until_complete(create_sensor())
    sensor2 = asyncio.get_event_loop().run_until_complete(create_sensor())

    route_test(app, get_admin_headers(), {}, {
        'sensor': {
            'dev_eui': sensor["dev_eui"].value
        },
        'beschreibung': 'Sensor Kaputt!',
        'raum': {
            'id': sensor["raum"]["id"].value
        }
    }, {
        'sensor': {
            'dev_eui': sensor2["dev_eui"].value
        },
        'beschreibung': 'WC spühlung kaputt.',
        'raum': {
            'id': sensor2["raum"]["id"].value
        }
    }, ['sensor.dev_eui', 'raum.id', 'beschreibung'], 'id', '/meldungen')
コード例 #7
0
import tedious.config
from starlette.testclient import TestClient

from bbbapi.routes import create_app
from .route_test_util import route_test
from ..util import get_admin_headers, get_personal_headers, create_gebaeude, \
    create_stockwerk
import asyncio

tedious.config.load_config('config.ini')

app = create_app()


def test_stockwerke_route():
    gebaeude = asyncio.get_event_loop().run_until_complete(create_gebaeude())
    gebaeude2 = asyncio.get_event_loop().run_until_complete(create_gebaeude())

    route_test(
        app, get_admin_headers(), get_personal_headers(), {
            'name': 'Obergeschoss',
            'niveau': 0,
            'gebaeude': {
                'id': gebaeude["id"].value
            }
        }, {
            'name': 'Obergeschoss',
            'niveau': 0,
            'gebaeude': {
                'id': gebaeude2["id"].value
            }
コード例 #8
0
def test_gebaeude_route():
    app = create_app()
    route_test(app, get_admin_headers(), get_personal_headers(), {'name': 'Martinsberg'}, {'name': 'Bruggerstrasse'}, ['name'], 'id', '/gebaeude')