Пример #1
0
def test_role_model_can_object_map_for_sql_alchemy(get_role):
    """."""
    role = models.role_factory(STORAGE_STRATEGY, **get_role())
    # Raises exception if not ORM model.
    object_mapper(role)

    assert isinstance(role, sql.Role)
Пример #2
0
def test_user_model_can_object_map_for_sql_alchemy(get_user):
    """."""
    user = models.user_factory(STORAGE_STRATEGY, **get_user())
    # Raises exception if not ORM model.
    object_mapper(user)

    assert isinstance(user, sql.User)
Пример #3
0
def test_permission_model_can_object_map_for_sql_alchemy(get_permission):
    """."""
    permission = models.permission_factory(STORAGE_STRATEGY,
                                           **get_permission())
    # Raises exception if not ORM model.
    object_mapper(permission)

    assert isinstance(permission, sql.Permission)
Пример #4
0
 def is_mapped(v):
     if v is None:
         return v
     try:
         object_mapper(v)
     except UnmappedInstanceError:
         return None
     return v
Пример #5
0
 def is_mapped(value):
     """
     Check if value is an ORM mapped object
     :param value: Input value
     :type value: Multiple type
     :return: True if mapped otherwise false
     :rtype: Boolean
     """
     try:
         object_mapper(value)
         return True
     except UnmappedInstanceError:
         return False
Пример #6
0
def is_mapped(obj):
    try:
        object_mapper(obj)
    except UnmappedInstanceError:
        return False
    return True
Пример #7
0
def _is_sa_object_mapped(obj):
    try:
        object_mapper(obj)
    except UnmappedInstanceError:
        return False
    return True