mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-21 19:03:08 +00:00
Change URL from PokéAPI to gh for sprites (#257)
This commit is contained in:
parent
01c36b9a72
commit
404f23abd1
3 changed files with 11 additions and 10 deletions
|
@ -1402,11 +1402,11 @@ class ItemDetailSerializer(serializers.ModelSerializer):
|
|||
sprites_object = ItemSprites.objects.get(item_id=obj)
|
||||
sprites_data = ItemSpritesSerializer(sprites_object, context=self.context).data
|
||||
sprites_data = json.loads(sprites_data['sprites'])
|
||||
host = self.context['request'].META['HTTP_HOST']
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'http://' + host + sprites_data[key]
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
return sprites_data
|
||||
|
||||
|
@ -2303,11 +2303,11 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer):
|
|||
sprites_data = PokemonFormSpritesSerializer(sprites_object, context=self.context).data
|
||||
sprites_data = json.loads(sprites_data['sprites'])
|
||||
|
||||
host = self.context['request'].META['HTTP_HOST']
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'http://' + host + sprites_data[key]
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
return sprites_data
|
||||
|
||||
|
@ -2519,11 +2519,11 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
|
|||
sprites_object = PokemonSprites.objects.get(pokemon_id=obj)
|
||||
sprites_data = PokemonSpritesSerializer(sprites_object, context=self.context).data
|
||||
sprites_data = json.loads(sprites_data['sprites'])
|
||||
host = self.context['request'].META['HTTP_HOST']
|
||||
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
|
||||
for key, val in sprites_data.iteritems():
|
||||
if sprites_data[key]:
|
||||
sprites_data[key] = 'http://' + host + sprites_data[key]
|
||||
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
|
||||
|
||||
return sprites_data
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from pokemon_v2.models import * # NOQA
|
|||
import json
|
||||
|
||||
test_host = 'http://testserver'
|
||||
media_sprites = '/media/sprites/{}'
|
||||
media_host = 'https://raw.githubusercontent.com/PokeAPI/sprites/master/'
|
||||
api_v2 = '/api/v2'
|
||||
|
||||
|
||||
|
@ -2716,7 +2716,7 @@ class APITests(APIData, APITestCase):
|
|||
# sprites
|
||||
self.assertEqual(
|
||||
response.data['sprites']['default'],
|
||||
'{}{}'.format(test_host, sprites_data['default']))
|
||||
'{}{}'.format(media_host, sprites_data['default'].replace('/media/', '')))
|
||||
|
||||
# Berry Tests
|
||||
def test_berry_firmness_api(self):
|
||||
|
@ -4253,7 +4253,7 @@ class APITests(APIData, APITestCase):
|
|||
# sprite params
|
||||
self.assertEqual(
|
||||
response.data['sprites']['front_default'],
|
||||
'{}{}'.format(test_host, sprites_data['front_default']))
|
||||
'{}{}'.format(media_host, sprites_data['front_default'].replace('/media/', '')))
|
||||
self.assertEqual(response.data['sprites']['back_default'], None)
|
||||
|
||||
def test_pokemon_form_api(self):
|
||||
|
@ -4292,7 +4292,7 @@ class APITests(APIData, APITestCase):
|
|||
# sprite params
|
||||
self.assertEqual(
|
||||
response.data['sprites']['front_default'],
|
||||
'{}{}'.format(test_host, sprites_data['front_default']))
|
||||
'{}{}'.format(media_host, sprites_data['front_default'].replace('/media/', '')))
|
||||
self.assertEqual(response.data['sprites']['back_default'], None)
|
||||
|
||||
# Evolution test
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<ul>
|
||||
<li><a href="#info">Information</a></li>
|
||||
<li><a href="#fairuse">Fair Use</a></li>
|
||||
<li><a href="#slack">Slack</a></li>
|
||||
<li><a href="#wrap">Wrappers</a></li>
|
||||
|
||||
|
|
Loading…
Reference in a new issue