예제 #1
0
def test_minimal_rel_hydrate():
    dehydrated = {
        "self": "http://localhost:7474/db/data/relationship/11",
    }
    hydrated = Rel.hydrate(dehydrated)
    assert isinstance(hydrated, Rel)
    assert hydrated.bound
    assert hydrated.resource.uri == dehydrated["self"]
예제 #2
0
def test_rel_hydrate_with_type():
    dehydrated = {
        "self": "http://localhost:7474/db/data/relationship/11",
        "type": "KNOWS",
    }
    hydrated = Rel.hydrate(dehydrated)
    assert isinstance(hydrated, Rel)
    assert hydrated.type == dehydrated["type"]
    assert hydrated.bound
    assert hydrated.resource.uri == dehydrated["self"]
예제 #3
0
def test_rel_hydrate_with_properties():
    dehydrated = {
        "self": "http://localhost:7474/db/data/relationship/11",
        "data": {
            "since": 1999,
        },
    }
    hydrated = Rel.hydrate(dehydrated)
    assert isinstance(hydrated, Rel)
    assert hydrated.properties == dehydrated["data"]
    assert hydrated.bound
    assert hydrated.resource.uri == dehydrated["self"]
예제 #4
0
def test_full_rel_hydrate():
    dehydrated = {
        "extensions": {
        },
        "start": "http://localhost:7474/db/data/node/23",
        "property": "http://localhost:7474/db/data/relationship/11/properties/{key}",
        "self": "http://localhost:7474/db/data/relationship/11",
        "properties": "http://localhost:7474/db/data/relationship/11/properties",
        "type": "KNOWS",
        "end": "http://localhost:7474/db/data/node/22",
        "data": {
            "since": 1999,
        },
    }
    hydrated = Rel.hydrate(dehydrated)
    assert isinstance(hydrated, Rel)
    assert hydrated.type == dehydrated["type"]
    assert hydrated.properties == dehydrated["data"]
    assert hydrated.bound
    assert hydrated.resource.uri == dehydrated["self"]