Пример #1
0
def test_to_dict_merg_index_image(
        fixture_merge_index_image_build_details_json):
    mii_model = MergeIndexImageModel(
        id=4,
        arches=["x86_64"],
        state="in_progress",
        state_reason="state_reason",
        request_type="merge-index-image",
        state_history=[],
        batch=1,
        batch_annotations={"batch_annotations": 1},
        logs={},
        updated="updated",
        user="******",
        binary_image="binary_image",
        binary_image_resolved="binary_image_resolved",
        deprecation_list=[],
        index_image="index_image",
        distribution_scope="null",
        source_from_index="source_from_index",
        source_from_index_resolved="source_from_index_resolved",
        target_index="target_index",
        target_index_resolved="target_index_resolved",
    )
    model = MergeIndexImageModel.from_dict(
        fixture_merge_index_image_build_details_json).to_dict()
    assert model == mii_model.to_dict()
Пример #2
0
def test_from_dict_success(
    fixture_add_build_details_json,
    fixture_rm_build_details_json,
    fixture_regenerate_bundle_build_details_json,
    fixture_optional_args_missing_json,
    fixture_merge_index_image_build_details_json,
):

    model1 = IIBBuildDetailsModel.from_dict(fixture_add_build_details_json)
    assert model1 == AddModel(**fixture_add_build_details_json)

    model2 = IIBBuildDetailsModel.from_dict(fixture_rm_build_details_json)
    assert model2 == RmModel(**fixture_rm_build_details_json)

    model3 = IIBBuildDetailsModel.from_dict(
        fixture_regenerate_bundle_build_details_json)
    assert model3 == RegenerateBundleModel(
        **fixture_regenerate_bundle_build_details_json)

    model4 = IIBBuildDetailsModel.from_dict(fixture_optional_args_missing_json)
    assert model4 == RegenerateBundleModel(
        **fixture_optional_args_missing_json)

    model5 = IIBBuildDetailsModel.from_dict(
        fixture_merge_index_image_build_details_json)
    assert model5 == MergeIndexImageModel(
        **fixture_merge_index_image_build_details_json)
Пример #3
0
def test_merge_index_image_model_attributes(
    fixture_merge_index_image_build_details_json, ):
    model = MergeIndexImageModel.from_dict(
        fixture_merge_index_image_build_details_json)

    assert model.binary_image == model._data["binary_image"]
    assert model.binary_image_resolved == model._data["binary_image_resolved"]
    assert model.deprecation_list == model._data["deprecation_list"]
    assert model.distribution_scope == model._data["distribution_scope"]
    assert model.index_image == model._data["index_image"]
    assert model.source_from_index == model._data["source_from_index"]
    assert model.source_from_index_resolved == model._data[
        "source_from_index_resolved"]
    assert model.target_index == model._data["target_index"]
    assert model.target_index_resolved == model._data["target_index_resolved"]