Skip to content

Commit 12ba0ac

Browse files
committed
Rename test cases
1 parent 82327bf commit 12ba0ac

File tree

6 files changed

+112
-72
lines changed

6 files changed

+112
-72
lines changed

tests/tests_character.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _compare_character(self, mock_character, character):
3232
self.assertEqual(mock_character.sex, character.sex)
3333

3434
# region Tibia.com Character Tests
35-
def test_from_content(self):
35+
def test_character_from_content(self):
3636
"""Testing parsing a character's HTML content"""
3737
character = Character.from_content(self._load_resource(FILE_CHARACTER_RESOURCE))
3838
self._compare_character(Character("Tschas", "Gladera", Vocation.DRUID, 260, Sex.FEMALE), character)
@@ -54,13 +54,13 @@ def test_from_content(self):
5454
self.assertEqual(5, len(character.other_characters))
5555
self.assertFalse(character.hidden)
5656

57-
def test_from_content_not_found(self):
57+
def test_character_from_content_not_found(self):
5858
"""Testing parsing a character not found page"""
5959
content = self._load_resource(FILE_CHARACTER_NOT_FOUND)
6060
char = Character.from_content(content)
6161
self.assertIsNone(char)
6262

63-
def test_from_content_with_former_names(self):
63+
def test_character_from_content_with_former_names(self):
6464
"""Testing parsing a character that has former names"""
6565
content = self._load_resource(FILE_CHARACTER_FORMER_NAMES)
6666
char = Character.from_content(content)
@@ -74,15 +74,15 @@ def test_from_content_with_former_names(self):
7474
self.assertEqual(char.house.world, char.world)
7575
self.assertIsInstance(char.house.paid_until_date, datetime.date)
7676

77-
def test_from_content_with_position(self):
77+
def test_character_from_content_with_position(self):
7878
"""Testing parsing a character with a position"""
7979
content = self._load_resource(FILE_CHARACTER_SPECIAL_POSITION)
8080
char = Character.from_content(content)
8181
self.assertEqual(char.name, "Steve")
8282
self.assertEqual(char.position, "CipSoft Member")
8383
self.assertEqual(char.account_information.position, "CipSoft Member")
8484

85-
def test_from_content_deleted_character(self):
85+
def test_character_from_content_deleted_character(self):
8686
"""Testing parsing a character scheduled for deletion"""
8787
content = self._load_resource(FILE_CHARACTER_DELETION)
8888
char = Character.from_content(content)
@@ -91,7 +91,7 @@ def test_from_content_deleted_character(self):
9191
self.assertIsInstance(char.deletion_date, datetime.datetime)
9292
self.assertEqual(parse_tibia_datetime("Oct 08 2018 22:17:00 CEST"), char.deletion_date)
9393

94-
def test_from_content_complex_deaths(self):
94+
def test_character_from_content_complex_deaths(self):
9595
"""Testing parsing a character with complex deaths (summons, assists, etc)"""
9696
content = self._load_resource(FILE_CHARACTER_DEATHS_COMPLEX)
9797
char = Character.from_content(content)
@@ -101,7 +101,7 @@ def test_from_content_complex_deaths(self):
101101
oldest_death = char.deaths[-1]
102102
self.assertEqual(oldest_death.killer.summon, "a fire elemental")
103103

104-
def test_from_content_badges_and_title(self):
104+
def test_character_from_content_badges_and_title(self):
105105
"""Testing parsing a character with account badges and a title"""
106106
content = self._load_resource(FILE_CHARACTER_TITLE_BADGES)
107107
char = Character.from_content(content)
@@ -117,7 +117,7 @@ def test_from_content_badges_and_title(self):
117117
self.assertIsInstance(badge.icon_url, str)
118118
self.assertIsInstance(badge.description, str)
119119

120-
def test_from_content_unrelated(self):
120+
def test_character_from_content_unrelated(self):
121121
"""Testing parsing an unrelated tibia.com section"""
122122
content = self._load_resource(self.FILE_UNRELATED_SECTION)
123123
with self.assertRaises(InvalidContent):
@@ -139,7 +139,7 @@ def test_death_types(self):
139139

140140
# region TibiaData Character tests
141141

142-
def test_from_tibiadata(self):
142+
def test_character_from_tibiadata(self):
143143
"""Testing parsing TibiaData content"""
144144
content = self._load_resource(FILE_CHARACTER_TIBIADATA)
145145
char = Character.from_tibiadata(content)
@@ -157,7 +157,7 @@ def test_from_tibiadata(self):
157157

158158
self.assertTrue(char.deaths[3].by_player)
159159

160-
def test_from_tibiadata_unhidden(self):
160+
def test_character_from_tibiadata_unhidden(self):
161161
"""Testing parsing an unhidden character"""
162162
content = self._load_resource(FILE_CHARACTER_TIBIADATA_UNHIDDEN)
163163
char = Character.from_tibiadata(content)
@@ -172,7 +172,7 @@ def test_from_tibiadata_unhidden(self):
172172
self.assertEqual(char.house.world, char.world)
173173
self.assertIsInstance(char.house.paid_until_date, datetime.date)
174174

175-
def test_from_tibiadata_deleted(self):
175+
def test_character_from_tibiadata_deleted(self):
176176
"""Testing parsing a deleted character"""
177177
content = self._load_resource(FILE_CHARACTER_TIBIADATA_DELETED)
178178
char = Character.from_tibiadata(content)
@@ -184,15 +184,15 @@ def test_from_tibiadata_deleted(self):
184184
self.assertIsNone(char.guild_name)
185185
self.assertIsNone(char.last_login)
186186

187-
def test_from_tibiadata_position(self):
187+
def test_character_from_tibiadata_position(self):
188188
"""Testing parsing a character with position"""
189189
content = self._load_resource(FILE_CHARACTER_TIBIADATA_SPECIAL_POSITION)
190190
char = Character.from_tibiadata(content)
191191
self.assertEqual(char.name, "Steve")
192192
self.assertEqual(char.position, "CipSoft Member")
193193
self.assertEqual(char.account_information.position, "CipSoft Member")
194194

195-
def test_from_tibiadata_summon_deaths(self):
195+
def test_character_from_tibiadata_summon_deaths(self):
196196
"""Testing parsing a character with summon deaths"""
197197
content = self._load_resource(FILE_CHARACTER_TIBIADATA_DEATHS_SUMMON)
198198
char = Character.from_tibiadata(content)
@@ -202,18 +202,18 @@ def test_from_tibiadata_summon_deaths(self):
202202
self.assertTrue(summon_death.killers[2].summon, "a fire elemental")
203203
self.assertTrue(summon_death.killers[2].name, "Hasi Pupsi")
204204

205-
def test_from_tibiadata_not_found(self):
205+
def test_character_from_tibiadata_not_found(self):
206206
"""Testing parsing a not found character"""
207207
content = self._load_resource(FILE_CHARACTER_TIBIADATA_NOT_FOUND)
208208
char = Character.from_tibiadata(content)
209209
self.assertIsNone(char)
210210

211-
def test_from_tibiadata_invalid_json(self):
211+
def test_character_from_tibiadata_invalid_json(self):
212212
"""Testing parsing an invalid JSON string"""
213213
with self.assertRaises(InvalidContent):
214214
Character.from_tibiadata("<html><b>Not a json string</b></html>")
215215

216-
def test_from_tibiadata_unrelated_json(self):
216+
def test_character_from_tibiadata_unrelated_json(self):
217217
"""Testing parsing an unrelated TibiaData section"""
218218
with self.assertRaises(InvalidContent):
219219
Character.from_tibiadata(self._load_resource(tests.tests_guild.FILE_GUILD_TIBIADATA))

tests/tests_client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def setUp(self):
2323
async def tearDown(self):
2424
await self.client.session.close()
2525

26-
async def test_constructor_pass_session(self):
26+
async def test_client_init_pass_session(self):
2727
"""Testing creating an instance passing a session"""
2828
headers = {"User-Agent": "Python Unit Test"}
2929
session = aiohttp.ClientSession(headers=headers)
@@ -34,7 +34,7 @@ async def test_constructor_pass_session(self):
3434
await client.session.close()
3535

3636
@aioresponses()
37-
async def test_handle_errors(self, mock):
37+
async def test_client_handle_errors(self, mock):
3838
"""Testing error handling"""
3939
mock.get(WorldOverview.get_url(), status=403)
4040
with self.assertRaises(Forbidden):
@@ -53,7 +53,7 @@ async def test_handle_errors(self, mock):
5353
await self.client.fetch_recent_news(30)
5454

5555
@aioresponses()
56-
async def test_fetch_character(self, mock):
56+
async def test_client_fetch_character(self, mock):
5757
"""Testing fetching a character"""
5858
name = "Tschas"
5959
content = self._load_resource(FILE_CHARACTER_RESOURCE)
@@ -63,7 +63,7 @@ async def test_fetch_character(self, mock):
6363
self.assertIsInstance(character, Character)
6464

6565
@aioresponses()
66-
async def test_fetch_character_not_found(self, mock):
66+
async def test_client_fetch_character_not_found(self, mock):
6767
"""Testing fetching a non existent character"""
6868
name = "Nezune"
6969
content = self._load_resource(FILE_CHARACTER_NOT_FOUND)
@@ -73,7 +73,7 @@ async def test_fetch_character_not_found(self, mock):
7373
self.assertIsNone(character)
7474

7575
@aioresponses()
76-
async def test_fetch_guild(self, mock):
76+
async def test_client_fetch_guild(self, mock):
7777
"""Testing fetching a guild"""
7878
name = "Vitam et Mortem"
7979
content = self._load_resource(FILE_GUILD_FULL)
@@ -83,7 +83,7 @@ async def test_fetch_guild(self, mock):
8383
self.assertIsInstance(guild, Guild)
8484

8585
@aioresponses()
86-
async def test_fetch_world_guilds(self, mock):
86+
async def test_client_fetch_world_guilds(self, mock):
8787
"""Testing fetching a world's guild list"""
8888
world = "Zuna"
8989
content = self._load_resource(FILE_GUILD_LIST)
@@ -93,7 +93,7 @@ async def test_fetch_world_guilds(self, mock):
9393
self.assertIsInstance(guilds[0], ListedGuild)
9494

9595
@aioresponses()
96-
async def test_fetch_highscores_page(self, mock):
96+
async def test_client_fetch_highscores_page(self, mock):
9797
"""Testing fetching a highscores page"""
9898
world = "Estela"
9999
category = Category.MAGIC_LEVEL
@@ -105,7 +105,7 @@ async def test_fetch_highscores_page(self, mock):
105105
self.assertIsInstance(highscores, Highscores)
106106

107107
@aioresponses()
108-
async def test_fetch_house(self, mock):
108+
async def test_client_fetch_house(self, mock):
109109
"""Testing fetching a house"""
110110
world = "Antica"
111111
house_id = 5236
@@ -116,7 +116,7 @@ async def test_fetch_house(self, mock):
116116
self.assertIsInstance(house, House)
117117

118118
@aioresponses()
119-
async def test_fetch_world_houses(self, mock):
119+
async def test_client_fetch_world_houses(self, mock):
120120
"""Testing fetching a world's houses"""
121121
world = "Antica"
122122
city = "Edron"
@@ -128,7 +128,7 @@ async def test_fetch_world_houses(self, mock):
128128
self.assertIsInstance(houses[0], ListedHouse)
129129

130130
@aioresponses()
131-
async def test_fetch_kill_statistics(self, mock):
131+
async def test_client_fetch_kill_statistics(self, mock):
132132
"""Testing fetching kill statistics"""
133133
world = "Antica"
134134
content = self._load_resource(FILE_KILL_STATISTICS_FULL)
@@ -138,7 +138,7 @@ async def test_fetch_kill_statistics(self, mock):
138138
self.assertIsInstance(kill_statistics, KillStatistics)
139139

140140
@aioresponses()
141-
async def test_fetch_recent_news(self, mock):
141+
async def test_client_fetch_recent_news(self, mock):
142142
"""Testing fetching recent nows"""
143143
content = self._load_resource(FILE_NEWS_LIST)
144144
mock.post(ListedNews.get_list_url(), status=200, body=content)
@@ -147,15 +147,15 @@ async def test_fetch_recent_news(self, mock):
147147
self.assertIsInstance(recent_news, list)
148148
self.assertIsInstance(recent_news[0], ListedNews)
149149

150-
async def test_fetch_news_archive_invalid_dates(self):
150+
async def test_client_fetch_news_archive_invalid_dates(self):
151151
"""Testing fetching news archive with invalid dates"""
152152
today = datetime.date.today()
153153
yesterday = today - datetime.timedelta(days=1)
154154
with self.assertRaises(ValueError):
155155
await self.client.fetch_news_archive(today, yesterday)
156156

157157
@aioresponses()
158-
async def test_fetch_news(self, mock):
158+
async def test_client_fetch_news(self, mock):
159159
"""Testing fetch news"""
160160
news_id = 6000
161161
content = self._load_resource(FILE_NEWS_ARTICLE)
@@ -165,7 +165,7 @@ async def test_fetch_news(self, mock):
165165
self.assertIsInstance(news, News)
166166

167167
@aioresponses()
168-
async def test_fetch_world(self, mock):
168+
async def test_client_fetch_world(self, mock):
169169
"""Testing fetching a world"""
170170
name = "Antica"
171171
content = self._load_resource(FILE_WORLD_FULL)
@@ -175,7 +175,7 @@ async def test_fetch_world(self, mock):
175175
self.assertIsInstance(world, World)
176176

177177
@aioresponses()
178-
async def test_fetch_world_list(self, mock):
178+
async def test_client_fetch_world_list(self, mock):
179179
"""Testing fetching the world list"""
180180
content = self._load_resource(FILE_WORLD_LIST)
181181
mock.get(WorldOverview.get_url(), status=200, body=content)
@@ -184,7 +184,7 @@ async def test_fetch_world_list(self, mock):
184184
self.assertIsInstance(worlds, WorldOverview)
185185

186186
@aioresponses()
187-
async def test_fetch_boosted_creature(self, mock):
187+
async def test_client_fetch_boosted_creature(self, mock):
188188
"""Testing fetching the boosted creature"""
189189
content = self._load_resource(self.FILE_UNRELATED_SECTION)
190190
mock.get(News.get_list_url(), status=200, body=content)

tests/tests_creature.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
class TestCreature(TestCommons, unittest.TestCase):
88
# region Tibia.com Tests
9-
def testBoostedCreature(self):
9+
def test_creature_from_content(self):
10+
"""Testing parsing a boosted creature"""
1011
content = self._load_resource(self.FILE_UNRELATED_SECTION)
1112
creature = BoostedCreature.from_content(content)
1213

1314
self.assertIsInstance(creature, BoostedCreature)
1415
self.assertEqual("Skeleton Warrior", creature.name)
1516

16-
def testBoostedCreatureNotTibiaCom(self):
17+
def test_creature_from_content_not_tibiacom(self):
18+
"""Testing parsing a page that is not Tibia.com"""
1719
with self.assertRaises(InvalidContent):
1820
BoostedCreature.from_content("<html><div><p>Nothing</p></div></html>")
1921

0 commit comments

Comments
 (0)