Beispiel #1
0
def test_user_copy_cbor_to_fbs(user_cbor):
    user_fbs = UserFbs()
    user_fbs.copy(user_cbor)

    # assert user_fbs == user_cbor

    assert user_fbs.oid == user_cbor.oid
    assert user_fbs.label == user_cbor.label
    assert user_fbs.description == user_cbor.description
    assert user_fbs.tags == user_cbor.tags
    assert user_fbs.email == user_cbor.email
    assert user_fbs.registered == user_cbor.registered
    assert user_fbs.pubkey == user_cbor.pubkey
Beispiel #2
0
    def loop():
        _user = UserFbs.cast(data)
        if True:
            assert _user.oid == user_fbs.oid
            assert len(str(_user.oid)) == 36
            assert _user.label == user_fbs.label
            assert _user.description == user_fbs.description
            assert _user.tags == user_fbs.tags

            assert _user.email == user_fbs.email
            assert _user.registered == user_fbs.registered
            assert _user.pubkey == user_fbs.pubkey
            assert len(_user.pubkey) == 64
Beispiel #3
0
def test_user_fbs_roundtrip(user_fbs, builder):
    # serialize to bytes (flatbuffers) from python object
    obj = user_fbs.build(builder)
    builder.Finish(obj)
    data = builder.Output()

    # create python object from bytes (flatbuffes)
    _user = UserFbs.cast(data)

    # assert _user == user_fbs

    assert _user.oid == user_fbs.oid
    assert _user.label == user_fbs.label
    assert _user.description == user_fbs.description
    assert _user.tags == user_fbs.tags
    assert _user.email == user_fbs.email
    assert _user.registered == user_fbs.registered
    assert _user.pubkey == user_fbs.pubkey
Beispiel #4
0
def user_fbs():
    _user = UserFbs()
    fill_user(_user)
    return _user