当前位置: 首页>>代码示例>>Python>>正文


Python User.add方法代码示例

本文整理汇总了Python中models.user.User.add方法的典型用法代码示例。如果您正苦于以下问题:Python User.add方法的具体用法?Python User.add怎么用?Python User.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_and_get_users

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_add_and_get_users(self):
     bid0 = Board.add("board0", "A")
     board0 = Board.get(bid0)
     uid0 = User.add("test1", "password", "[email protected]")
     user0 = User.get(uid0)
     uid1 = User.add("test2", "password", "[email protected]")
     user1 = User.get(uid0)
     board0.add_user(user0)
     assert str(uid0) in board0.get_user_ids()
     assert str(uid1) not in board0.get_user_ids()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:12,代码来源:test_board.py

示例2: test_get_cards_by_list_id

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_get_cards_by_list_id(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     card_id = Card.add("card0", lid0, uid0)
     card = Card.get(card_id)
     assert card_id in [card.id for card in Card.get_cards_by_list_id(lid0)]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:9,代码来源:test_card.py

示例3: test_add_and_get_cards

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
    def test_add_and_get_cards(self):
        uid0 = User.add("test_user1", "password", "[email protected]")
        user0 = User.get(uid0)
        uid1 = User.add("test_user2", "password", "[email protected]")
        user1 = User.get(uid1)
        bid0 = Board.add("board1", "A")
        lid0 = List.add("List0", bid0)

        caid0 = Card.add("card1", lid0, uid0)
        caid1 = Card.add("card2", lid0, uid1)
        card0 = Card.get(caid0)


        print caid0, user0.get_card_ids()
        assert str(caid0) in user0.get_card_ids()
        assert str(caid1) not in user0.get_card_ids()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:18,代码来源:test_user.py

示例4: test_get_user_ids

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_get_user_ids(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     card_id = Card.add("card0", lid0, uid0)
     card = Card.get(card_id)
     assert str(uid0) in [user_id for user_id in card.get_user_ids()]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:9,代码来源:test_card.py

示例5: test_set_and_get_card

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_set_and_get_card(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     card_id = Card.add("card0", lid0, uid0)
     card = Card.get(card_id)
     assert card.title == 'card0'
     assert card.list_id == lid0
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:10,代码来源:test_card.py

示例6: test_get_and_test_description

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_get_and_test_description(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     card_id = Card.add("card0", lid0, uid0)
     card = Card.get(card_id)
     card.set_description('desc')
     assert 'desc' in card.get_description()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:10,代码来源:test_card.py

示例7: test_add_and_get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_add_and_get(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     aid0 = Activity.add(bid0, uid0, "BLABLA")
     activity0 = Activity.get(aid0)
     assert bid0 == activity0.board_id
     assert uid0 == activity0.user_id
     assert "BLABLA" == activity0.content
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:10,代码来源:test_activity.py

示例8: incr_decr_get_comment

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def incr_decr_get_comment(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     card_id = Card.add("card0", lid0, uid0)
     card = Card.get(card_id)
     Card.incr_comment(card_id)
     assert 1 == card.get_comment_count()
     Card.desc_comment(card_id)
     assert 0 == card.get_comment_count()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:12,代码来源:test_card.py

示例9: test_add_and_get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
 def test_add_and_get(self):
     uid0 = User.add("test1", "password", "[email protected]")
     bid0 = Board.add("board1", "A")
     lid0 = List.add("To Do", bid0)
     caid0 = Card.add("card1", lid0, uid0)
     coid0 = Comment.add(caid0, uid0, "comment1")
     comment0 = Comment.get(coid0)
     assert caid0 == comment0.card_id
     assert uid0 == comment0.user_id
     assert "comment1" == comment0.content
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:12,代码来源:test_comment.py

示例10: test_add_and_get_boards

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
    def test_add_and_get_boards(self):
        cid = User.add("test_user1", "password", "[email protected]")
        user = User.get(cid)

        bid0 = Board.add("board1", "A")
        bid1 = Board.add("board2", "A")
        board0 = Board.get(bid0)
        board1 = Board.get(bid1)
        user.add_board(board0)

        assert str(bid0) in user.get_board_ids()
        assert str(bid1) not in user.get_board_ids()
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:14,代码来源:test_user.py

示例11: test_get_cards

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
    def test_get_cards(self):
        bid0 = Board.add("board1", "A")
        lid0 = List.add("List0", bid0) 
        list0 = List.get(lid0)
        lid1 = List.add("List1", bid0) 
        list1 = List.get(lid1)

        uid0 = User.add("test1", "password", "[email protected]")
        
        caid0 = Card.add("card1", lid0, uid0)
        caid1 = Card.add("card2", lid1, uid0)

        assert caid0 in [card.id for card in list0.get_cards()]
        assert caid1 not in [card.id for card in list0.get_cards()]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:16,代码来源:test_list.py

示例12: test_get_comments_by_card_id

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
    def test_get_comments_by_card_id(self):
        uid0 = User.add("test1", "password", "[email protected]")
        bid0 = Board.add("board1", "A")
        lid0 = List.add("To Do", bid0)

        caid0 = Card.add("card1", lid0, uid0)
        caid1 = Card.add("card2", lid0, uid0)

        coid0 = Comment.add(caid0, uid0, "comment1")
        coid1 = Comment.add(caid1, uid0, "comment2")

        comment0 = Comment.get(coid0)
        comment1 = Comment.get(coid1)

        assert coid0 in [comment.id for comment in Comment.get_comments_by_card_id(caid0)]
        assert coid1 not in [comment.id for comment in Comment.get_comments_by_card_id(caid0)]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:18,代码来源:test_comment.py

示例13: test_get_comments_by_card_id

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
    def test_get_comments_by_card_id(self):
        uid0 = User.add("test1", "password", "[email protected]")
        bid0 = Board.add("board1", "A")
        bid1 = Board.add("board2", "A")
        aid0 = Activity.add(bid0, uid0, "BLABLA")
        aid1 = Activity.add(bid0, uid0, "LA")
        aid2 = Activity.add(bid1, uid0, "HULA")

        activity0 = Activity.get(aid0)
        activity1 = Activity.get(aid1)
        activity2 = Activity.get(aid2)

        assert aid0 in [activity.id for activity in Activity.get_all(bid0)]
        assert aid1 in [activity.id for activity in Activity.get_all(bid0)]
        assert aid2 not in [activity.id for activity in Activity.get_all(bid0)]
        assert aid2 in [activity.id for activity in Activity.get_all(bid1)]
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:18,代码来源:test_activity.py

示例14:

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
from models.card import Card
from models.comment import Comment
from utils.db import mysql_engine, r_server

r_server.flushdb()
Board.__table__.drop(mysql_engine, checkfirst=True)
Board.__table__.create(mysql_engine, checkfirst=True)
User.__table__.drop(mysql_engine, checkfirst=True)
User.__table__.create(mysql_engine, checkfirst=True)
List.__table__.drop(mysql_engine, checkfirst=True)
List.__table__.create(mysql_engine, checkfirst=True)
Card.__table__.drop(mysql_engine, checkfirst=True)
Card.__table__.create(mysql_engine, checkfirst=True)
Comment.__table__.drop(mysql_engine, checkfirst=True)
Comment.__table__.create(mysql_engine, checkfirst=True)
uid0 = User.add("test1", "password", "[email protected]")
uid1 = User.add("test2", "password", "[email protected]")
uid2 = User.add("test3", "password", "[email protected]")

user0 = User.get(uid0)
user1 = User.get(uid1)
user2 = User.get(uid2)

bid0 = Board.add("board1", "A")
bid1 = Board.add("board2", "A")

board0 = Board.get(bid0)
board1 = Board.get(bid1)

board0.add_user(user0)
board0.add_user(user1)
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:33,代码来源:test_data.py

示例15:

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import add [as 别名]
# -*- coding: utf-8 -*-
from models.user import User

User.add("what", "password", "[email protected]")
User.add("yay", "password", "[email protected]")
User.add("lsduf fdfe", "password", "[email protected]")
User.add("toilet", "password", "[email protected]")
User.add("sorbitol", "password", "[email protected]")

User.add("washroom", "password", "[email protected]")
User.add("happiness", "password", "[email protected]")
User.add("zebra", "password", "[email protected]")
User.add("pp ll oooookay", "password", "[email protected]")
User.add("face of what", "password", "[email protected]")

User.add("reason", "password", "[email protected]")
User.add("abandon", "password", "[email protected]")
User.add("moron", "password", "[email protected]")
User.add("bad people", "password", "[email protected]")
User.add("vandal", "password", "[email protected]")
开发者ID:GuangzheGao,项目名称:sorbitol,代码行数:22,代码来源:test_add_users.py


注:本文中的models.user.User.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。