コード例 #1
0
def test_DeleteEntryExist(storage_populated, dispatcher, entry_notifier,
                          is_server):
    storage = storage_populated

    storage.deleteEntry("foo2")

    entry = storage.m_entries.get("foo2")
    assert entry is not None
    assert entry.value is None
    assert entry.id == 0xFFFF
    assert entry.local_write == False

    # client shouldn't send an update as id not assigned yet
    if is_server:
        # id assigned as this is the server
        dispatcher._queueOutgoing.assert_has_calls(
            [call(Message.entryDelete(1), None, None)])
    else:
        # shouldn't send an update id not assigned yet
        assert dispatcher._queueOutgoing.call_count == 0

    entry_notifier.notifyEntry.assert_has_calls([
        call(1, "foo2", Value.makeDouble(0.0),
             NT_NOTIFY_DELETE | NT_NOTIFY_LOCAL)
    ])

    if is_server:
        assert len(storage.m_idmap) >= 2
        assert not storage.m_idmap[1]
コード例 #2
0
def test_wire_entryDelete(msg_round_trip):
    msg_round_trip(Message.entryDelete(0x1234), minver=0x0300)