1
0
Fork 0
This repository has been archived on 2023-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
dailyreleases/tests/test_parse_releases.py

59 lines
2.2 KiB
Python
Raw Normal View History

2018-07-31 17:34:45 +02:00
import unittest
from datetime import datetime, timedelta
from dailyreleases import parsing
from dailyreleases.parsing import Platform, ReleaseType
from dailyreleases.predbs import PredbRelease
2018-07-31 17:34:45 +02:00
class ParseReleasesTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.empty_releases = {platform: {release_type: [] for release_type in ReleaseType}
for platform in Platform}
def test_dont_skip(self):
already_posted = set()
releases = [
PredbRelease("Aztez-DARKSiDERS", "nfo_link", datetime.now())
]
parsed_releases = parsing.parse_releases(releases, already_posted)
self.assertEqual(parsed_releases[Platform.WINDOWS][ReleaseType.GAME][0].game_name, "Aztez")
2018-07-31 17:34:45 +02:00
def test_skip_already_posted(self):
already_posted = {"Aztez-DARKSiDERS"}
releases = [
PredbRelease("Aztez-DARKSiDERS", "nfo_link", datetime.now())
]
parsed_releases = parsing.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases, self.empty_releases)
2018-07-31 17:34:45 +02:00
def test_skip_blacklisted_word(self):
already_posted = set()
releases = [
PredbRelease("Anthemion.Software.DialogBlocks.v5.15.LINUX.Incl.Keygen-AMPED", "nfo_link", datetime.now())
]
parsed_releases = parsing.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases, self.empty_releases)
2018-07-31 17:34:45 +02:00
def test_skip_older_than_48hr(self):
already_posted = set()
releases = [
PredbRelease("Aztez-DARKSiDERS", "nfo_link", datetime.now() - timedelta(hours=50))
]
parsed_releases = parsing.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases, self.empty_releases)
2018-07-31 17:34:45 +02:00
def test_skip_no_data_for_software(self):
already_posted = set()
releases = [
PredbRelease("Tecplot.RS.2017.R1.v1.2.85254.X64-AMPED", "nfo_link", datetime.now())
]
parsed_releases = parsing.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases, self.empty_releases)
2018-07-31 17:34:45 +02:00
if __name__ == '__main__':
unittest.main()