46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
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()
|