1515FILE_GUILD_LIST_NOT_FOUND = "guild/tibiacom_list_not_found.txt"
1616FILE_GUILD_IN_WAR = "guild/tibiacom_war.txt"
1717
18- FILE_GUILD_TIBIADATA = "guild/tibiadata.json"
19- FILE_GUILD_TIBIADATA_NOT_FOUND = "guild/tibiadata_not_found.json"
20- FILE_GUILD_TIBIADATA_DISBANDING = "guild/tibiadata_disbanding.json"
21- FILE_GUILD_TIBIADATA_INVITED = "guild/tibiadata_invited.json"
22- FILE_GUILD_TIBIADATA_LIST = "guild/tibiadata_list.json"
23- FILE_GUILD_TIBIADATA_LIST_NOT_FOUND = "guild/tibiadata_list_not_found.json"
24-
2518FILE_GUILD_WAR_ACTIVE_HISTORY = "guild/wars/tibiacom_active_history.txt"
2619FILE_GUILD_WAR_EMPTY = "guild/wars/tibiacom_empty.txt"
2720FILE_GUILD_WAR_UNACTIVE_HISTORY = "guild/wars/tibiacom_unactive_history.txt"
@@ -38,7 +31,6 @@ def test_guild_from_content(self):
3831 self .assertIsInstance (guild , Guild , "Guild should be a Guild object." )
3932 self .assertEqual (guild .url , Guild .get_url (guild .name ))
4033 self .assertEqual (guild .url_wars , Guild .get_url_wars (guild .name ))
41- self .assertEqual (guild .url_tibiadata , Guild .get_url_tibiadata (guild .name ))
4234 self .assertTrue (guild .active , "Guild should be active" )
4335 self .assertIsInstance (guild .founded , datetime .date , "Guild founded date should be an instance of datetime.date" )
4436 self .assertTrue (guild .open_applications , "Guild applications should be open" )
@@ -211,78 +203,6 @@ def test_guild_init_founded(self):
211203 self .assertIsNone (Guild (founded = None ).founded )
212204 self .assertIsNone (Guild (founded = "Jul 20" ).founded )
213205
214- def test_guild_from_tibiadata (self ):
215- """Testing parsing a guild from TibiaData"""
216- content = self .load_resource (FILE_GUILD_TIBIADATA )
217- guild = Guild .from_tibiadata (content )
218-
219- self .assertIsInstance (guild , Guild )
220- self .assertTrue (guild .open_applications )
221- self .assertIsNotNone (guild .guildhall )
222- self .assertEqual (guild .founded , datetime .date (2002 , 2 , 18 ))
223- self .assertIsInstance (guild .guildhall , GuildHouse )
224- self .assertEqual (guild .guildhall .world , guild .world )
225- self .assertIsNotNone (guild .logo_url )
226-
227- def test_guild_from_tibiadata_not_found (self ):
228- """Testing parsing a non existent guild"""
229- content = self .load_resource (FILE_GUILD_TIBIADATA_NOT_FOUND )
230- guild = Guild .from_tibiadata (content )
231- self .assertIsNone (guild )
232-
233- def test_guild_from_tibiadata_disbanding (self ):
234- """Testing parsing a disbanding guild from TibiaData"""
235- content = self .load_resource (FILE_GUILD_TIBIADATA_DISBANDING )
236- guild = Guild .from_tibiadata (content )
237- self .assertIsNotNone (guild .disband_condition )
238- self .assertEqual (guild .disband_date , datetime .date (2018 , 12 , 26 ))
239-
240- def test_guild_from_tibiadata_with_invites (self ):
241- """Testing parsing a guild with invites"""
242- content = self .load_resource (FILE_GUILD_TIBIADATA_INVITED )
243- guild = Guild .from_tibiadata (content )
244- self .assertTrue (len (guild .invites ) > 0 )
245- self .assertIsInstance (guild .invites [0 ], GuildInvite )
246-
247- def test_guild_from_tibiadata_invalid_json (self ):
248- """Testing parsing an invalid json"""
249- with self .assertRaises (InvalidContent ):
250- Guild .from_tibiadata ("<html><p>definitely not a json string</p></html>" )
251-
252- def test_guild_from_tibiadata_unrelated_section (self ):
253- """Testing parsing a different TibiaData json"""
254- content = self .load_resource (tests .tests_character .FILE_CHARACTER_TIBIADATA )
255- with self .assertRaises (InvalidContent ):
256- Guild .from_tibiadata (content )
257-
258- def test_listed_guild_from_tibiadata (self ):
259- """Testing parsing a guild list from TibiaData"""
260- content = self .load_resource (FILE_GUILD_TIBIADATA_LIST )
261- guilds = ListedGuild .list_from_tibiadata (content )
262- self .assertTrue (guilds )
263- self .assertIsNotNone (ListedGuild .get_world_list_url_tibiadata (guilds [0 ].world ))
264- self .assertEqual ("Zunera" , guilds [0 ].world )
265- self .assertIsInstance (guilds [0 ], ListedGuild )
266- self .assertTrue (guilds [0 ].active )
267- self .assertFalse (guilds [- 1 ].active )
268-
269- def test_listed_guild_from_tibiadata_not_found (self ):
270- """Testing parsing a non existent guild"""
271- content = self .load_resource (FILE_GUILD_TIBIADATA_LIST_NOT_FOUND )
272- guilds = ListedGuild .list_from_tibiadata (content )
273- # There's no way to tell if the searched world doesn't exist or has no guilds
274- self .assertEqual (guilds , [])
275-
276- def test_listed_guild_from_tibiadata_unrelated_section (self ):
277- """Testing parsing an unrelated section"""
278- content = self .load_resource (tests .tests_character .FILE_CHARACTER_TIBIADATA )
279- with self .assertRaises (InvalidContent ):
280- ListedGuild .list_from_tibiadata (content )
281-
282- def test_listed_guild_from_tibiadata_invalid_json (self ):
283- """Testing parsing an invalid json"""
284- with self .assertRaises (InvalidContent ):
285- ListedGuild .list_from_tibiadata ("<b>Not JSON</b>" )
286206
287207 # region Guild War Tests
288208 def test_guild_wars_from_content_active_history (self ):
0 commit comments