Beispiel #1
0
def test_get_dataproduct_not_exist(datasource):  # noqa: F811
    """Does it error out if we ask for bogus information?"""
    with pytest.raises((KeyError, NoResultFound)):
        datasource.get_dataproduct(
            taskmanager_id=2,
            generation_id=2,
            key="no_such_key",
        )
Beispiel #2
0
def test_get_dataproduct(datasource):  # noqa: F811
    """Can we get the dataproduct by uuid with key"""
    result2 = datasource.get_dataproduct(
        taskmanager_id=2,
        generation_id=2,
        key="other_test_key",
    )

    assert result2 == b"other_test_value"
Beispiel #3
0
def test_update(datasource):  # noqa: F811
    """Do updates work as expected"""
    metadata_row = datasource.get_metadata(
        taskmanager_id=1,
        generation_id=1,
        key="my_test_key",
    )
    header_row = datasource.get_header(
        taskmanager_id=1,
        generation_id=1,
        key="my_test_key",
    )
    datasource.update(
        taskmanager_id=1,
        generation_id=1,
        key="my_test_key",
        value=b"I changed IT",
        header=Header(
            header_row[0],
            create_time=header_row[4],
            expiration_time=header_row[5],
            scheduled_create_time=header_row[6],
            creator=header_row[7],
            schema_id=header_row[8],
        ),
        metadata=Metadata(
            metadata_row[0],
            state=metadata_row[4],
            generation_id=metadata_row[2],
            generation_time=metadata_row[5],
            missed_update_count=metadata_row[6],
        ),
    )

    result1 = datasource.get_dataproduct(
        taskmanager_id=1,
        generation_id=1,
        key="my_test_key",
    )

    assert result1 == b"I changed IT"