コード例 #1
0
def test_insert(dataspace):  # noqa: F811
    """Can we insert new elements"""
    primary_key = dataspace.store_taskmanager(
        "taskmanager3", "33333333-3333-3333-3333-333333333333"
    )
    assert primary_key > 1

    header = Header(primary_key)
    metadata = Metadata(primary_key)
    dataspace.insert(
        primary_key,
        1,
        "sample_test_key",
        "sample_test_value".encode(),
        header,
        metadata,
    )

    result1 = dataspace.get_dataproducts(taskmanager_id=primary_key)

    assert result1 == [
        {
            "key": "sample_test_key",
            "taskmanager_id": primary_key,
            "generation_id": 1,
            "value": b"sample_test_value",
        }
    ]

    result2 = dataspace.get_dataproducts(
        taskmanager_id=primary_key, key="sample_test_key"
    )

    assert result1 == result2
コード例 #2
0
def test_store_taskmanager(dataspace):  # noqa: F811
    """Can we make new entries"""
    primary_key = dataspace.store_taskmanager(
        name="taskmanager3",
        taskmanager_id="00000003-0003-0003-0003-000000000003",
    )
    assert primary_key > 1