Skip to content

Commit

Permalink
Update test, workaround for python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Backes authored and Andrew Backes committed Mar 26, 2017
1 parent ffa2699 commit 9e866a2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/test_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Andrew Backes <[email protected]>

import vcr
import unittest
import vcr
from pokemontcgsdk import Card

# Python 3.6 Workaround until https://github.com/kevin1024/vcrpy/issues/293 is fixed.
vcr_connection_request = vcr.stubs.VCRConnection.request
vcr.stubs.VCRConnection.request = lambda *args, **kwargs: vcr_connection_request(*args)

class TestCard(unittest.TestCase):
def test_find_returns_card(self):
with vcr.use_cassette('fixtures/gardevoir.yaml'):
Expand All @@ -20,11 +24,11 @@ def test_find_returns_card(self):
self.assertEqual('Gardevoir', card.name)
self.assertEqual('xy7-54', card.id)
self.assertEqual(282, card.national_pokedex_number)
self.assertEqual('https://s3.amazonaws.com/pokemontcg/xy7/54.png', card.image_url)
self.assertEqual('https://images.pokemontcg.io/xy7/54.png', card.image_url)
self.assertEqual('Stage 2', card.subtype)
self.assertEqual('Pokémon', card.supertype)
self.assertEqual('Bright Heal', card.ability['name'])
self.assertEqual('Once during your turn (before your attack), you may heal 20 damage from each of your Pokémon.', card.ability['text'])
self.assertEqual('Once during your turn (before your attack), you may heal 20 damage from each of your Pokémon.',card.ability['text'])
self.assertEqual('130', card.hp)
self.assertEqual(['Colorless', 'Colorless'], card.retreat_cost)
self.assertEqual('54', card.number)
Expand All @@ -37,23 +41,21 @@ def test_find_returns_card(self):
self.assertTrue(len(card.attacks) == 1)
self.assertTrue(len(card.weaknesses) == 1)
self.assertTrue(len(card.resistances) == 1)

def test_all_with_params_return_cards(self):
with vcr.use_cassette('fixtures/mega_pokemon.yaml'):
cards = Card.where(supertype='pokemon') \
.where(subtype='mega') \
.all()

self.assertTrue(len(cards) >= 70)

def test_all_with_page_returns_cards(self):
with vcr.use_cassette('fixtures/all_first_page.yaml'):
cards = Card.where(page=1).all()

self.assertEqual(100, len(cards))

def test_all_with_page_and_page_size_returns_card(self):
with vcr.use_cassette('fixtures/all_first_page_one_card.yaml'):
cards = Card.where(page=1).where(pageSize=1).all()

self.assertEqual(1, len(cards))
self.assertEqual(1, len(cards))

0 comments on commit 9e866a2

Please sign in to comment.