Example #1
0
    def test_add_card_success_high_quant(self):
        deck = {'format': 'Old School 93-94', 'colors': 'w', 'cards': []}
        card = {
            'name': 'Healing Salve',
            'set': 'lea',
            'usd': 0.01,
            'png': 'https://example.com/salve',
            'cmc': 1,
            'colors': ['W']
        }
        updated_deck = {
            'format':
            'Old School 93-94',
            'colors':
            'w',
            'cards': [{
                'name': 'Healing Salve',
                'quantity': 12,
                'set': 'lea',
                'png': 'https://example.com/salve',
                'usd': 0.01
            }]
        }

        new_deck = tools.add_card_to_deck(deck,
                                          card,
                                          quantity=12,
                                          validate=False)
        assert new_deck == updated_deck
Example #2
0
    def test_add_card_bad_card(self):
        deck = {'format': 'Old School 93-94', 'colors': 'w', 'cards': []}
        card = {
            'name': 'Healing Salve',
            'usd': 0.01,
            'png': 'https://example.com/salve',
            'cmc': 1,
            'colors': ['W']
        }

        with pytest.raises(tools.InvalidCardDateException):
            new_deck = tools.add_card_to_deck(deck, card, quantity=4)
Example #3
0
    def test_add_card_failed_high_quant(self):
        deck = {'format': 'Old School 93-94', 'colors': 'w', 'cards': []}
        card = {
            'name': 'Healing Salve',
            'set': 'lea',
            'usd': 0.01,
            'png': 'https://example.com/salve',
            'cmc': 1,
            'colors': ['W']
        }

        with pytest.raises(tools.InvalidDeckDataException):
            new_deck = tools.add_card_to_deck(deck,
                                              card,
                                              quantity=12,
                                              validate=True)