本文整理汇总了Python中models.card.Card.add方法的典型用法代码示例。如果您正苦于以下问题:Python Card.add方法的具体用法?Python Card.add怎么用?Python Card.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.card.Card
的用法示例。
在下文中一共展示了Card.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_cards
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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()]
示例2: test_get_user_ids
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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()]
示例3: test_get_cards_by_list_id
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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)]
示例4: test_get_comments_by_card_id
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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)]
示例5: test_add_and_get_cards
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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()
示例6: test_get_and_test_description
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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()
示例7: test_set_and_get_card
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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
示例8: incr_decr_get_comment
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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()
示例9: test_add_and_get
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card 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
示例10: api_card
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import add [as 别名]
def api_card(list_id = None):
if request.method == 'GET':
list_id = request.args.get('list_id')
if list_id != None:
cards = Card.get_cards_by_list_id(list_id)
return jsonify(json_list=[card.serialize() for card in cards])
else:
return jsonify({'code': 404, 'message': 'Card ID not valid.'})
else:
try:
list_id = long(request.form['list_id'])
title = request.form['title']
except KeyError:
return jsonify({'code': 400, 'message': 'Bad Request'})
return jsonify({"card_id": Card.add(title, list_id, current_user.id)})
示例11:
# 需要导入模块: from models.card import Card [as 别名]
# 或者: from models.card.Card import add [as 别名]
board1.add_user(user1)
user0.add_board(board0)
user0.add_board(board1)
user1.add_board(board0)
user1.add_board(board1)
user2.add_board(board0)
user0.set_avatar('http://127.0.0.1:5000/_uploads/images/avatar_1.png')
user1.set_avatar('http://127.0.0.1:5000/_uploads/images/avatar_2.png')
lid0 = List.add("To Do", bid0)
lid1 = List.add("Doing", bid0)
lid2 = List.add("Done", bid0)
caid0 = Card.add("card1", lid0, uid0)
caid1 = Card.add("card2", lid0, uid0)
caid2 = Card.add("card3", lid1, uid0)
card0 = Card.get(caid0)
card0.add_user(user1)
card0.add_user(user2)
coid0 = Comment.add(caid0, uid0, "comment1")
coid1 = Comment.add(caid0, uid1, "comment2")
coid2 = Comment.add(caid0, uid2, "comment3")
'''
# -*- coding: utf-8 -*-