def test_token_copy_cbor_to_fbs(token_cbor): token_fbs = ActivationTokenFbs() token_fbs.copy(token_cbor) # assert token_fbs == token_cbor assert token_fbs.oid == token_cbor.oid assert token_fbs.atype == token_cbor.atype assert token_fbs.status == token_cbor.status assert token_fbs.completed == token_cbor.completed assert token_fbs.code == token_cbor.code assert token_fbs.email == token_cbor.email assert token_fbs.pubkey == token_cbor.pubkey
def loop(): _token = ActivationTokenFbs.cast(data) if True: assert _token.oid == token_fbs.oid assert len(str(token_fbs.oid)) == 36 assert _token.atype == token_fbs.atype assert _token.status == token_fbs.status assert _token.completed == token_fbs.completed assert _token.code == token_fbs.code assert _token.email == token_fbs.email assert _token.pubkey == token_fbs.pubkey assert len(token_fbs.pubkey) == 64
def test_token_fbs_roundtrip(token_fbs, builder): # serialize to bytes (flatbuffers) from python object obj = token_fbs.build(builder) builder.Finish(obj) data = builder.Output() assert len(data) == 224 # create python object from bytes (flatbuffes) _token = ActivationTokenFbs.cast(data) # assert _token == token_fbs assert _token.oid == token_fbs.oid assert _token.atype == token_fbs.atype assert _token.status == token_fbs.status assert _token.completed == token_fbs.completed assert _token.code == token_fbs.code assert _token.email == token_fbs.email assert _token.pubkey == token_fbs.pubkey
def token_fbs(): _token = ActivationTokenFbs() fill_token(_token) return _token