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

46 lines
1.5 KiB
Python
Raw Normal View History

2018-07-31 17:34:45 +02:00
import unittest
from datetime import datetime, timedelta
from dailyreleases.main import DailyReleasesBot
class ParseReleasesTestCase(unittest.TestCase):
def setUp(self):
self.bot = DailyReleasesBot()
def test_skip_already_posted(self):
already_posted = {"Aztez-DARKSiDERS"}
releases = {
"Aztez-DARKSiDERS": ("nfo_link", datetime.now())
}
parsed_releases = self.bot.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases[0], dict())
def test_skip_blacklisted_word(self):
already_posted = set()
releases = {
"Anthemion.Software.DialogBlocks.v5.15.LINUX.Incl.Keygen-AMPED": ("nfo_link", datetime.now())
}
parsed_releases = self.bot.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases[0], dict())
def test_skip_older_than_48hr(self):
already_posted = set()
releases = {
"Aztez-DARKSiDERS": ("nfo_link", datetime.now() - timedelta(hours=50))
}
parsed_releases = self.bot.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases[0], dict())
def test_skip_no_data_for_software(self):
already_posted = set()
releases = {
"Tecplot.RS.2017.R1.v1.2.85254.X64-AMPED": ("nfo_link", datetime.now())
}
parsed_releases = self.bot.parse_releases(releases, already_posted)
self.assertDictEqual(parsed_releases[0], dict())
if __name__ == '__main__':
unittest.main()