-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test, workaround for python 3.6
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'): | ||
|
@@ -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) | ||
|
@@ -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)) | ||
|