Beispiel #1
0
def test_simulation(simulation, mocker, app):
    app['config']['simulation'] = simulation
    mocker.patch(TESTED + '.service.run')
    mocker.patch(TESTED + '.service.create_app').return_value = app

    main.main()

    assert simulation == isinstance(commander.get_commander(app),
                                    commander_sim.SimulationCommander)
Beispiel #2
0
def test_list_devices(mocker, list_device_app):
    mocker.patch(TESTED + '.service.create_app').return_value = list_device_app
    run_mock = mocker.patch(TESTED + '.service.run')
    all_ports_mock = mocker.patch(TESTED + '.communication.all_ports')
    all_ports_mock.return_value = [['val1', 'val2'], ['val3']]

    main.main()

    assert all_ports_mock.call_count == 1
    assert run_mock.call_count == 0
Beispiel #3
0
def test_simulation(simulation, mocker, app):
    app['config']['simulation'] = simulation
    mocker.patch(TESTED + '.service.run')
    mocker.patch(TESTED + '.service.create_app').return_value = app

    main.main()

    if simulation:
        assert simulator.fget(app) is not None
    else:
        with pytest.raises(KeyError):
            simulator.fget(app)
Beispiel #4
0
def test_main(mocker, app):
    mocker.patch(TESTED + '.service.run')
    mocker.patch(TESTED + '.service.create_app').return_value = app

    main.main()

    assert None not in [
        commander.get_commander(app),
        datastore.get_datastore(app),
        device.get_controller(app),
        events.get_listener(app),
        broadcaster.get_broadcaster(app)
    ]
def test_main(mocker, app):
    mocker.patch(TESTED + '.service.run')
    mocker.patch(TESTED + '.service.create_app').return_value = app

    main.main()

    assert None not in [
        commander.fget(app),
        service_store.fget(app),
        block_store.fget(app),
        controller.fget(app),
        mqtt.handler(app),
        broadcaster.fget(app)
    ]
def test_simulation(simulation, mocker, app):
    app['config']['simulation'] = simulation
    mocker.patch(TESTED + '.service.run')
    mocker.patch(TESTED + '.service.create_app').return_value = app

    main.main()