Example #1
0
class MediaMapping(ProtoMapping):
    __proto__ = domain_pb2.UserMedia

    __source_input_type__ = sql.Media
    author = ProtoKey('author', UserMapping)
    download_url = ProtoKey('link', str)
    blob = ProtoKey('blob', bytes)
    content_type = ProtoKey('content_type', bytes)
Example #2
0
class UserMapping(ProtoMapping):
    __proto__ = domain_pb2.User
    __source_input_type__ = sql.User

    uuid = ProtoKey('id', str)
    email = ProtoKey('email', str)
    username = ProtoKey('login', str)
    tokens = ProtoList('tokens', UserAuthTokenMapping)
    metadata = ProtoKey('extra_info', dict)
Example #3
0
def test_field_mapping_cast_returns_doesnt_touch_value_target_type_none():
    "FieldMapping.cast() returns the value untouched if the target type is None"

    key = ProtoKey('username')

    value = object()

    result = key.cast(value)

    result.should.equal(value)
Example #4
0
class AuthResponseMapping(ProtoMapping):
    __proto__ = domain_pb2.AuthResponse

    token = ProtoKey('token', UserAuthTokenMapping)
Example #5
0
class UserAuthTokenMapping(ProtoMapping):
    __proto__ = domain_pb2.User.AuthToken
    __source_input_type__ = sql.AuthToken
    value = ProtoKey('data', str)
    created_at = ProtoKey('created_at', ProtobufTimestamp)
    expires_at = ProtoKey('expires_at', ProtobufTimestamp)
Example #6
0
class AuthRequestMapping(ProtoMapping):
    __proto__ = domain_pb2.AuthRequest

    username = ProtoKey('username', str)
    password = ProtoKey('password', str)
Example #7
0
class TimestampMapping(ProtoMapping):
    __proto__ = Timestamp

    seconds = ProtoKey('seconds', int)
Example #8
0
class TimestampMapping(ProtoMapping):
    __proto__ = Timestamp
    __source_input_type__ = MyCustomObjectWithTimestampData

    seconds = ProtoKey('seconds', int)