示例#1
0
 def test_add(self):
     """
     测试 添加信息
     """
     print self.test_add.__doc__.strip()
     from app.tools.db import add
     from app.models import User
     # 测试正确的场景
     user_info = {
         'email': '*****@*****.**',
         'password': '******',
         'nickname': 'Bob',
     }
     result = add(User, user_info)
     assert result == 4
     # 测试错误的场景
     user_info = {
         'email': '*****@*****.**',
         'password': '******',
         # 'nickname': 'Error',
     }
     try:
         result = add(User, user_info)
     except Exception as e:
         assert e.message == '(sqlite3.IntegrityError) NOT NULL constraint failed: user.nickname'
     assert result == 4
示例#2
0
 def test_add(self):
     """
     测试 添加信息
     """
     print self.test_add.__doc__.strip()
     from app.tools.db import add
     from app.models import User
     # 测试正确的场景
     user_info = {
         'email': '*****@*****.**',
         'password': '******',
         'nickname': 'Bob',
     }
     result = add(User, user_info)
     assert result == 4
     # 测试错误的场景
     user_info = {
         'email': '*****@*****.**',
         'password': '******',
         # 'nickname': 'Error',
     }
     try:
         result = add(User, user_info)
     except Exception as e:
         assert e.message == '(sqlite3.IntegrityError) NOT NULL constraint failed: user.nickname'
     assert result == 4
示例#3
0
def add_user_auth(user_auth_data):
    """
    添加用户信息
    :param user_auth_data:
    :return: None/Value of user.id
    """
    return add(UserAuth, user_auth_data)
示例#4
0
def add_blog(blog_data):
    """
    添加博客信息
    :param blog_data:
    :return: None/Value of blog.id
    """
    return add(Blog, blog_data)
示例#5
0
def add_user(user_data):
    """
    添加用户信息
    :param user_data:
    :return: None/Value of user.id
    """
    return add(LoginUser, user_data)
示例#6
0
def add_blog(blog_data):
    """
    添加博客信息
    :param blog_data:
    :return: None/Value of blog.id
    """
    return add(Blog, blog_data)
示例#7
0
def add_author(author_data):
    """
    添加博客信息
    :param author_data:
    :return: None/Value of author.id
    """
    return add(Author, author_data)
示例#8
0
def add_user(user_data):
    """
    添加用户信息
    :param user_data:
    :return: None/Value of user.id
    """
    return add(LoginUser, user_data)
示例#9
0
def add_user_auth(user_auth_data):
    """
    添加用户信息
    :param user_auth_data:
    :return: None/Value of user.id
    """
    return add(UserAuth, user_auth_data)
示例#10
0
def add_author(author_data):
    """
    添加博客信息
    :param author_data:
    :return: None/Value of author.id
    """
    return add(Author, author_data)