Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 4
0
def add_blog(blog_data):
    """
    添加博客信息
    :param blog_data:
    :return: None/Value of blog.id
    """
    return add(Blog, blog_data)
Esempio n. 5
0
def add_user(user_data):
    """
    添加用户信息
    :param user_data:
    :return: None/Value of user.id
    """
    return add(LoginUser, user_data)
Esempio n. 6
0
def add_blog(blog_data):
    """
    添加博客信息
    :param blog_data:
    :return: None/Value of blog.id
    """
    return add(Blog, blog_data)
Esempio n. 7
0
def add_author(author_data):
    """
    添加博客信息
    :param author_data:
    :return: None/Value of author.id
    """
    return add(Author, author_data)
Esempio n. 8
0
def add_user(user_data):
    """
    添加用户信息
    :param user_data:
    :return: None/Value of user.id
    """
    return add(LoginUser, user_data)
Esempio n. 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)
Esempio n. 10
0
def add_author(author_data):
    """
    添加博客信息
    :param author_data:
    :return: None/Value of author.id
    """
    return add(Author, author_data)