Exemple #1
0
async def test_turn_on_autoupdate(communicator, set_config):
    await set_config("general_system_enable_anonymous", True)
    await communicator.connect()

    await communicator.send_json_to({
        "type": "autoupdate",
        "content": "on",
        "id": "test_id"
    })
    await asyncio.sleep(0.01)
    # Change a config value
    await set_config("general_event_name", "Test Event")
    response = await communicator.receive_json_from()

    id = config.get_key_to_id()["general_event_name"]
    type = response.get("type")
    content = response.get("content")
    assert type == "autoupdate"
    assert content["changed"] == {
        "core/config": [{
            "id": id,
            "key": "general_event_name",
            "value": "Test Event"
        }]
    }
Exemple #2
0
async def test_turn_on_autoupdate(communicator):
    await set_config('general_system_enable_anonymous', True)
    await communicator.connect()

    await communicator.send_json_to({
        'type': 'autoupdate',
        'content': 'on',
        'id': 'test_id'
    })
    await asyncio.sleep(0.01)
    # Change a config value
    await set_config('general_event_name', 'Test Event')
    response = await communicator.receive_json_from()

    id = config.get_key_to_id()['general_event_name']
    type = response.get('type')
    content = response.get('content')
    assert type == 'autoupdate'
    assert content['changed'] == {
        'core/config': [{
            'id': id,
            'key': 'general_event_name',
            'value': 'Test Event'
        }]
    }
Exemple #3
0
async def test_changed_data_autoupdate_on(get_communicator):
    await set_config('general_system_enable_anonymous', True)
    communicator = get_communicator('autoupdate=on')
    await communicator.connect()

    # Change a config value
    await set_config('general_event_name', 'Test Event')
    response = await communicator.receive_json_from()

    id = config.get_key_to_id()['general_event_name']
    type = response.get('type')
    content = response.get('content')
    assert type == 'autoupdate'
    assert content['changed'] == {
        'core/config': [{'id': id, 'key': 'general_event_name', 'value': 'Test Event'}]}
async def test_receive_changed_data(communicator):
    await set_config('general_system_enable_anonymous', True)
    await communicator.connect()
    await communicator.receive_json_from()

    # Change a config value after the startup data has been received
    await set_config('general_event_name', 'Test Event')
    response = await communicator.receive_json_from()

    id = config.get_key_to_id()['general_event_name']
    type = response.get('type')
    content = response.get('content')
    assert type == 'autoupdate'
    assert content == [
        {'action': 'changed',
         'collection': 'core/config',
         'data': {'id': id, 'key': 'general_event_name', 'value': 'Test Event'},
         'id': id}]
Exemple #5
0
async def test_changed_data_autoupdate_on(get_communicator, set_config):
    await set_config("general_system_enable_anonymous", True)
    communicator = get_communicator("autoupdate=on")
    await communicator.connect()

    # Change a config value
    await set_config("general_event_name", "Test Event")
    response = await communicator.receive_json_from()

    id = config.get_key_to_id()["general_event_name"]
    type = response.get("type")
    content = response.get("content")
    assert type == "autoupdate"
    assert content["changed"] == {
        "core/config": [{
            "id": id,
            "key": "general_event_name",
            "value": "Test Event"
        }]
    }