Exemplo n.º 1
0
def test_copy_with_new_lumapps_uuids():
    with open("tests/legacy/test_data/content_1.json") as fh:
        content = json.load(fh)
    content2 = copy_with_new_lumapps_uuids(content)
    assert content != content2
    with_uuid = list(iter_with_key(content, "uuid"))
    assert len(with_uuid) == 4
    assert with_uuid[0]["uuid"] == "2c2649f3-87de-46c6-bff3-ca3cbe3a8aa6"
    assert with_uuid[1]["uuid"] == "2ad93c14-0a9d-4d0e-a91b-eb38e1025991"
    assert with_uuid[2]["uuid"] == "f0951e06-ffb6-4406-a9c5-97e0be977f94"
    assert with_uuid[3]["uuid"] == "ae9aac74-1ee5-45c2-9a57-8e447ad663f3"
    with_uuid = list(iter_with_key(content2, "uuid"))
    assert len(with_uuid) == 4
    assert with_uuid[0]["uuid"] != "2c2649f3-87de-46c6-bff3-ca3cbe3a8aa6"
    assert with_uuid[1]["uuid"] != "2ad93c14-0a9d-4d0e-a91b-eb38e1025991"
    assert with_uuid[2]["uuid"] != "f0951e06-ffb6-4406-a9c5-97e0be977f94"
    assert with_uuid[3]["uuid"] != "ae9aac74-1ee5-45c2-9a57-8e447ad663f3"
Exemplo n.º 2
0
def test_iter_with_key_3():
    with open("tests/legacy/test_data/content_1.json") as fh:
        content = json.load(fh)
    matches = list(iter_with_key([content], "instance"))
    assert len(matches) == 3