2018-07-31 17:34:45 +02:00
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
self.assertEqual("DARKSiDERS", p["group"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/app/244750", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
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")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Update", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Update", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_linux_release(self):
|
|
|
|
p = self.bot.parse_dirname("Sphinx_And_The_Cursed_Mummy_Linux-Razor1911")
|
|
|
|
self.assertEqual("Linux", p["platform"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/app/558244", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_incl_dlc_update(self):
|
|
|
|
p = self.bot.parse_dirname("Wolfenstein.II.The.New.Colossus.Update.5.incl.DLC-CODEX")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Update", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_incl_dlc_release(self):
|
|
|
|
p = self.bot.parse_dirname("Mutiny.Incl.DLC-DARKSiDERS")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
2018-08-03 03:30:17 +02:00
|
|
|
def test_score_steam(self):
|
2018-07-31 17:34:45 +02:00
|
|
|
p1 = self.bot.parse_dirname("BioShock_Infinite-FLT")
|
|
|
|
p2 = self.bot.parse_dirname("Duke.Nukem.Forever.Complete-PLAZA")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertGreater(p1["score"], p2["score"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_non_steam(self):
|
|
|
|
p = self.bot.parse_dirname("Battlefield.1.REPACK-CPY")
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("www.origin.com/usa/en-us/store/battlefield/battlefield-1", p["store_links"]["Origin"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual(-1, p["score"])
|
|
|
|
self.assertEqual(-1, p["num_reviews"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_gog_exclusive(self):
|
|
|
|
p = self.bot.parse_dirname("Dungeons.and.Dragons.Dragonshard.v2.0.0.10.Multilingual-DELiGHT")
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("gog.com/game/dungeons_dragons_dragonshard", p["store_links"]["GOG"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual(-1, p["score"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
2018-08-03 03:30:17 +02:00
|
|
|
def test_score_non_steam(self):
|
2018-07-31 17:34:45 +02:00
|
|
|
p = self.bot.parse_dirname("Ode.RIP.MULTI12-SiMPLEX")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual(-1, p["score"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Update", p["type"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/sub/202103", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/sub/124923", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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"])
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Game", p["type"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/bundle/232", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
2018-08-04 19:37:19 +02:00
|
|
|
def test_steam_denuvo(self):
|
|
|
|
# "denuvo" occurs in the Steam EULA
|
2018-07-31 17:34:45 +02:00
|
|
|
p = self.bot.parse_dirname("Deus.Ex.Mankind.Divided-CPY")
|
2018-08-04 19:37:19 +02:00
|
|
|
self.assertEqual(["DENUVO"], p["highlights"])
|
|
|
|
|
|
|
|
# "denuvo" occurs in the Steam DRM notice
|
|
|
|
p = self.bot.parse_dirname("Yakuza.0-FAKE")
|
2018-07-31 17:34:45 +02:00
|
|
|
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"])
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("store.steampowered.com/app/704740", p["store_links"]["Steam"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
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")
|
2018-08-03 03:30:17 +02:00
|
|
|
self.assertEqual("Update", p["type"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
def test_readnfo_microsoft_store(self):
|
|
|
|
p = self.bot.parse_dirname("Zoo.Tycoon.Ultimate.Animal.Collection.READNFO-CODEX")
|
2018-08-01 13:06:24 +02:00
|
|
|
self.assertIn("microsoft.com/en-us/p/zoo-tycoon-ultimate-animal-collection", p["store_links"]["Microsoft Store"])
|
2018-07-31 17:34:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|