Ejemplo n.º 1
0
def test_collectionfield_lock_with_non_collectionfield():
    locked_fields = {
        "collection/1": {
            "position": 1,
            "filter": {"field": "f", "operator": "=", "value": 1},
        }
    }
    with pytest.raises(InvalidFormat):
        WriteRequest(get_dummy_request_events(), {}, 1, locked_fields)
Ejemplo n.º 2
0
def test_collectionfield_lock():
    locked_fields = {
        "collection/field": {
            "position": 1,
            "filter": {"field": "f", "operator": "=", "value": 1},
        }
    }
    wr = WriteRequest(get_dummy_request_events(), {}, 1, locked_fields)

    assert isinstance(
        wr.locked_collectionfields["collection/field"], CollectionFieldLockWithFilter
    )
Ejemplo n.º 3
0
def test_collectionfield_lock_with_invalid_filter():
    locked_fields = {
        "collection/field": {"position": 1, "filter": {"field": "f", "operator": "="}}
    }
    with pytest.raises(BadCodingError):
        WriteRequest(get_dummy_request_events(), {}, 1, locked_fields)