import unittest from dailyreleases.main import DailyReleasesBot class ParseDirnameTestCase(unittest.TestCase): def setUp(self): self.bot = DailyReleasesBot() def test_single_word_release(self): p = self.bot.parse_dirname("Aztez-DARKSiDERS") self.assertEqual("Aztez-DARKSiDERS", p["dirname"]) self.assertEqual("Aztez", p["rls_name"]) self.assertEqual("Aztez", p["game_name"]) self.assertEqual("Windows", p["platform"]) self.assertEqual("Games", p["type"]) self.assertEqual("DARKSiDERS", p["group"]) self.assertIn("store.steampowered.com/app/244750", p["store_link"]) self.assertEqual("Steam", p["store_name"]) self.assertEqual([], p["tags"]) self.assertEqual([], p["highlights"]) def test_nuked_release(self): # TODO: Actual nuke handling? p = self.bot.parse_dirname("Battlefield.1-CPY") self.assertEqual("Battlefield.1-CPY", p["dirname"]) def test_update(self): p = self.bot.parse_dirname("Car.Mechanic.Simulator.2018.Plymouth.Update.v1.5.1.Hotfix-PLAZA") self.assertEqual("Updates", p["type"]) def test_proper_highlight(self): p = self.bot.parse_dirname("Death.Coming.PROPER-SiMPLEX") self.assertEqual(["PROPER"], p["highlights"]) def test_macos_release(self): p = self.bot.parse_dirname("The_Fall_Part_2_Unbound_MacOS-Razor1911") self.assertEqual("Mac OSX", p["platform"]) self.assertEqual("Games", p["type"]) def test_macosx_update(self): p = self.bot.parse_dirname("Man_O_War_Corsair_Warhammer_Naval_Battles_v1.3.2_MacOSX-Razor1911") self.assertEqual("Mac OSX", p["platform"]) self.assertEqual("Updates", p["type"]) def test_linux_release(self): p = self.bot.parse_dirname("Sphinx_And_The_Cursed_Mummy_Linux-Razor1911") self.assertEqual("Linux", p["platform"]) self.assertEqual("Games", p["type"]) def test_dlc_explicit(self): p = self.bot.parse_dirname("Fallout.4.Far.Harbor.DLC-CODEX") self.assertEqual("DLC", p["type"]) def test_dlc_implicit(self): p = self.bot.parse_dirname("Euro.Truck.Simulator.2.Italia-CODEX") self.assertEqual("DLC", p["type"]) self.assertIn("store.steampowered.com/app/558244", p["store_link"]) def test_incl_dlc_update(self): p = self.bot.parse_dirname("Wolfenstein.II.The.New.Colossus.Update.5.incl.DLC-CODEX") self.assertEqual("Updates", p["type"]) def test_incl_dlc_release(self): p = self.bot.parse_dirname("Mutiny.Incl.DLC-DARKSiDERS") self.assertEqual("Games", p["type"]) def test_popularity_steam(self): p1 = self.bot.parse_dirname("BioShock_Infinite-FLT") p2 = self.bot.parse_dirname("Duke.Nukem.Forever.Complete-PLAZA") self.assertGreater(p1["popularity"], p2["popularity"]) def test_non_steam(self): p = self.bot.parse_dirname("Battlefield.1.REPACK-CPY") self.assertIn("www.origin.com/usa/en-us/store/battlefield/battlefield-1", p["store_link"]) self.assertEqual("Origin", p["store_name"]) self.assertEqual(-1, p["popularity"]) def test_gog_exclusive(self): p = self.bot.parse_dirname("Dungeons.and.Dragons.Dragonshard.v2.0.0.10.Multilingual-DELiGHT") self.assertIn("gog.com/game/dungeons_dragons_dragonshard", p["store_link"]) self.assertEqual("GOG", p["store_name"]) self.assertEqual(-1, p["popularity"]) def test_popularity_non_steam(self): p = self.bot.parse_dirname("Ode.RIP.MULTI12-SiMPLEX") self.assertEqual(-1, p["popularity"]) def test_tags(self): p = self.bot.parse_dirname("Teenage.Mutant.Ninja.Turtles.Portal.Power.RIP.MULTI8-SiMPLEX") self.assertEqual(["RIP", "MULTI8"], p["tags"]) def test_skip_software(self): p = self.bot.parse_dirname("Tecplot.RS.2017.R1.v1.2.85254.X64-AMPED") self.assertIsNone(p) def test_steam_package(self): p = self.bot.parse_dirname("Farming.Simulator.17.Platinum.Edition.Update.v1.5.3-BAT") self.assertEqual("Farming Simulator 17 - Platinum Edition", p["game_name"]) self.assertEqual("Updates", p["type"]) self.assertIn("store.steampowered.com/sub/202103", p["store_link"]) self.assertEqual("Steam", p["store_name"]) def test_steam_package_with_dlc_first(self): p = self.bot.parse_dirname("The.Witcher.3.Wild.Hunt.Game.of.The.Year.Edition-RELOADED") self.assertEqual("The Witcher 3: Wild Hunt - Game of the Year Edition", p["game_name"]) self.assertEqual("Games", p["type"]) self.assertIn("store.steampowered.com/sub/124923", p["store_link"]) def test_steam_bundle(self): p = self.bot.parse_dirname("Valve.Complete.Pack-FAKE") self.assertEqual("Valve.Complete.Pack-FAKE", p["dirname"]) self.assertEqual("Valve Complete Pack", p["game_name"]) self.assertEqual("Windows", p["platform"]) self.assertEqual("Games", p["type"]) self.assertIn("store.steampowered.com/bundle/232", p["store_link"]) def test_denuvo_eula(self): p = self.bot.parse_dirname("Deus.Ex.Mankind.Divided-CPY") self.assertIn("store.steampowered.com/app/337000", p["store_link"]) self.assertEqual(["DENUVO"], p["highlights"]) def test_episode_release(self): p = self.bot.parse_dirname("Life.is.Strange.Before.the.Storm.Episode.3-CODEX") self.assertEqual("Life is Strange: Before the Storm Episode 3", p["game_name"]) self.assertEqual("DLC", p["type"]) self.assertIn("store.steampowered.com/app/704740", p["store_link"]) def test_season_and_episode_release(self): p = self.bot.parse_dirname("Minecraft.Story.Mode.Season.Two.Episode.5.MacOSX-RELOADED") self.assertEqual("Minecraft Story Mode Season Two Episode 5", p["game_name"]) def test_build_is_update(self): p = self.bot.parse_dirname("DUSK.Episode.1.Build.2.6-SKIDROW") self.assertEqual("Updates", p["type"]) def test_readnfo_microsoft_store(self): p = self.bot.parse_dirname("Zoo.Tycoon.Ultimate.Animal.Collection.READNFO-CODEX") self.assertIn("microsoft.com/en-us/p/zoo-tycoon-ultimate-animal-collection", p["store_link"]) if __name__ == '__main__': unittest.main()