-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
166 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"@context": "/v4/contexts/LeagueTable", | ||
"@id": "/v4/league_tables/116", | ||
"@type": "LeagueTable", | ||
"id": 116, | ||
"team": "/v4/teams/400", | ||
"externalId": "506208", | ||
"featuredTeam": false, | ||
"position": 12, | ||
"played": 2, | ||
"goalsFor": 1, | ||
"goalsAgainst": 5, | ||
"startDayPosition": 12, | ||
"won": 0, | ||
"lost": 1, | ||
"drawn": 1, | ||
"goalDifference": -4, | ||
"points": 1, | ||
"createdAt": "2020-02-25T14:42:27+00:00", | ||
"updatedAt": "2020-03-18T22:21:34+00:00", | ||
"competition": "/v4/competitions/58", | ||
"season": "/v4/seasons/9", | ||
"group": "/v4/league_table_groups/5" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"@context": "/v4/contexts/LeagueTableGroup", | ||
"@id": "/v4/league_table_groups/5", | ||
"@type": "LeagueTableGroup", | ||
"id": 5, | ||
"reference": "West", | ||
"title": "Group West", | ||
"createdAt": "2020-02-04T14:02:52+00:00", | ||
"updatedAt": "2020-02-04T14:02:52+00:00" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"@context": "/v4/contexts/MagicField", | ||
"@id": "/v4/magic_fields/1", | ||
"@type": "MagicField", | ||
"id": 1, | ||
"key": "wristbandId", | ||
"value": "ABCDEF", | ||
"createdAt": "2019-05-15T10:09:23+00:00", | ||
"updatedAt": "2019-05-15T10:10:09+00:00", | ||
"user": "/v4/users/274814" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"@context": "/v4/contexts/News", | ||
"@id": "/v4/news/6261", | ||
"@type": "News", | ||
"id": 6261, | ||
"featured": false, | ||
"url": "https://www.thenews.com", | ||
"imageUrl": "https://image.livestyled.com/abcdefg", | ||
"headline": "Some news", | ||
"title": "Things happened", | ||
"externalId": "50990", | ||
"status": "ACTIVE", | ||
"publishedAt": "2020-02-23T04:56:59+00:00", | ||
"createdAt": "2020-02-24T14:43:50+00:00", | ||
"updatedAt": "2020-03-18T01:15:07+00:00", | ||
"media": { | ||
"id": 458911, | ||
"type": "EXTERNALVIDEO", | ||
"url": "https://www.thenews.com/video", | ||
"createdAt": "2020-02-26T10:50:07+00:00", | ||
"updatedAt": "2020-02-26T10:50:07+00:00" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
|
||
from livestyled.schemas.league_table import LeagueTableSchema | ||
|
||
|
||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') | ||
TEST_API_DOMAIN = 'test.livestyled.com' | ||
|
||
|
||
def test_deserialize_league_table(): | ||
with open(os.path.join(FIXTURES_DIR, 'league_table.json'), 'r') as fixture_file: | ||
league_table = fixture_file.read() | ||
deserialized_league_table = LeagueTableSchema().loads(league_table) | ||
assert deserialized_league_table == { | ||
'id': 116, | ||
'team_id': 400, | ||
'external_id': '506208', | ||
'featured_team': False, | ||
'position': 12, | ||
'played': 2, | ||
'goals_for': 1, | ||
'goals_against': 5, | ||
'start_day_position': 12, | ||
'won': 0, | ||
'lost': 1, | ||
'drawn': 1, | ||
'goal_difference': -4, | ||
'points': 1, | ||
'competition_id': 58, | ||
'season_id': 9, | ||
'group_id': 5 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
|
||
from livestyled.schemas.league_table import LeagueTableGroupSchema | ||
|
||
|
||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') | ||
TEST_API_DOMAIN = 'test.livestyled.com' | ||
|
||
|
||
def test_deserialize_league_table_group(): | ||
with open(os.path.join(FIXTURES_DIR, 'league_table_group.json'), 'r') as fixture_file: | ||
league_table_group = fixture_file.read() | ||
deserialized_league_table_group = LeagueTableGroupSchema().loads(league_table_group) | ||
assert deserialized_league_table_group == { | ||
'id': 5, | ||
'reference': 'West', | ||
'title': 'Group West', | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
|
||
from livestyled.schemas.magic_field import MagicFieldSchema | ||
|
||
|
||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') | ||
TEST_API_DOMAIN = 'test.livestyled.com' | ||
|
||
|
||
def test_deserialize_league_table(): | ||
with open(os.path.join(FIXTURES_DIR, 'magic_field.json'), 'r') as fixture_file: | ||
magic_field = fixture_file.read() | ||
deserialized_magic_field = MagicFieldSchema().loads(magic_field) | ||
assert deserialized_magic_field == { | ||
'id': 1, | ||
'key': 'wristbandId', | ||
'value': 'ABCDEF', | ||
'user_id': 274814 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from datetime import datetime, timedelta, timezone | ||
import os | ||
|
||
from livestyled.schemas.news import NewsSchema | ||
|
||
|
||
FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures') | ||
TEST_API_DOMAIN = 'test.livestyled.com' | ||
|
||
|
||
def test_deserialize_league_table(): | ||
with open(os.path.join(FIXTURES_DIR, 'news.json'), 'r') as fixture_file: | ||
news = fixture_file.read() | ||
deserialized_news = NewsSchema().loads(news) | ||
assert deserialized_news == { | ||
'id': 6261, | ||
'author': None, | ||
'external_id': '50990', | ||
'headline': 'Some news', | ||
'image_url': 'https://image.livestyled.com/abcdefg', | ||
'media': { | ||
'type': 'EXTERNALVIDEO', | ||
'url': 'https://www.thenews.com/video' | ||
}, | ||
'published_at': datetime(2020, 2, 23, 4, 56, 59, tzinfo=timezone(timedelta(0), '+0000')), | ||
'title': 'Things happened', | ||
'updated_at': datetime(2020, 3, 18, 1, 15, 7, tzinfo=timezone(timedelta(0), '+0000')), | ||
'url': 'https://www.thenews.com' | ||
} |