當前位置: 首頁>>代碼示例>>Python>>正文


Python Card.add方法代碼示例

本文整理匯總了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()]
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:16,代碼來源:test_list.py

示例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()]
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:9,代碼來源:test_card.py

示例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)]
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:9,代碼來源:test_card.py

示例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)]
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:18,代碼來源:test_comment.py

示例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()
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:18,代碼來源:test_user.py

示例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()
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:10,代碼來源:test_card.py

示例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
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:10,代碼來源:test_card.py

示例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()
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:12,代碼來源:test_card.py

示例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
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:12,代碼來源:test_comment.py

示例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)})
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:18,代碼來源:views.py

示例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 -*-
開發者ID:GuangzheGao,項目名稱:sorbitol,代碼行數:33,代碼來源:test_data.py


注:本文中的models.card.Card.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。