Exemplo n.º 1
0
 def test_get_row_by_id(self):
     """
     测试 通过主键获取信息
     """
     print self.test_get_row_by_id.__doc__.strip()
     from app.tools.db import get_row_by_id
     from app.models import User
     # 测试有记录的场景
     row = get_row_by_id(User, 1)
     assert row.id == 1
     assert row.email == '*****@*****.**'
     assert row.nickname == 'Admin'
     # 测试无记录的场景
     row = get_row_by_id(User, 100)
     assert row is None
Exemplo n.º 2
0
 def test_get_row_by_id(self):
     """
     测试 通过主键获取信息
     """
     print self.test_get_row_by_id.__doc__.strip()
     from app.tools.db import get_row_by_id
     from app.models import User
     # 测试有记录的场景
     row = get_row_by_id(User, 1)
     assert row.id == 1
     assert row.email == '*****@*****.**'
     assert row.nickname == 'Admin'
     # 测试无记录的场景
     row = get_row_by_id(User, 100)
     assert row is None
Exemplo n.º 3
0
def get_user_auth_row_by_id(user_auth_id):
    """
    通过 id 获取用户信息
    :param user_auth_id:
    :return: None/object
    """
    return get_row_by_id(UserAuth, user_auth_id)
Exemplo n.º 4
0
def get_blog_row_by_id(blog_id):
    """
    通过 id 获取博客信息
    :param blog_id:
    :return: None/object
    """
    return get_row_by_id(Blog, blog_id)
Exemplo n.º 5
0
def get_user_row_by_id(user_id):
    """
    通过 id 获取用户信息
    :param user_id:
    :return: None/object
    """
    return get_row_by_id(LoginUser, user_id)
Exemplo n.º 6
0
def get_blog_row_by_id(blog_id):
    """
    通过 id 获取博客信息
    :param blog_id:
    :return: None/object
    """
    return get_row_by_id(Blog, blog_id)
Exemplo n.º 7
0
def get_author_row_by_id(author_id):
    """
    通过 id 获取博客信息
    :param author_id:
    :return: None/object
    """
    return get_row_by_id(Author, author_id)
Exemplo n.º 8
0
def get_user_row_by_id(user_id):
    """
    通过 id 获取用户信息
    :param user_id:
    :return: None/object
    """
    return get_row_by_id(LoginUser, user_id)
Exemplo n.º 9
0
def get_user_auth_row_by_id(user_auth_id):
    """
    通过 id 获取用户信息
    :param user_auth_id:
    :return: None/object
    """
    return get_row_by_id(UserAuth, user_auth_id)
Exemplo n.º 10
0
def get_author_row_by_id(author_id):
    """
    通过 id 获取博客信息
    :param author_id:
    :return: None/object
    """
    return get_row_by_id(Author, author_id)