def testGetEntryById(self): Indexer(name="nzbindex").save() n = NzbIndex(getIndexerSettingByName("nzbindex")) with open("mock/nzbindex--details.html", encoding="latin-1") as f: xml = f.read() with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps: url_re = re.compile(r'.*') rsps.add(responses.GET, url_re, body=xml, status=200, content_type='application/x-html') item = n.get_entry_by_id("aguid", "atitle") self.assertEqual("atitle", item.title) self.assertEqual(3816816, item.size) self.assertEqual("alt.binaries.pwp | alt.binaries.usenetrevolution", item.group) self.assertEqual("[email protected] (Janusch)", item.poster) self.assertEqual("https://nzbindex.com/download/aguid/atitle.nzb", item.link) self.assertEqual("https://nzbindex.com/release/aguid/atitle.nzb", item.details_link)
def testGetEntryById(self): Indexer(name="nzbindex").save() n = NzbIndex(getIndexerSettingByName("nzbindex")) with open("mock/nzbindex--details.html", encoding="latin-1") as f: xml = f.read() with responses.RequestsMock( assert_all_requests_are_fired=False) as rsps: url_re = re.compile(r'.*') rsps.add(responses.GET, url_re, body=xml, status=200, content_type='application/x-html') item = n.get_entry_by_id("aguid", "atitle") self.assertEqual("atitle", item.title) self.assertEqual(3816816, item.size) self.assertEqual( "alt.binaries.pwp | alt.binaries.usenetrevolution", item.group) self.assertEqual("[email protected] (Janusch)", item.poster) self.assertEqual("https://nzbindex.com/download/aguid/atitle.nzb", item.link) self.assertEqual("https://nzbindex.com/release/aguid/atitle.nzb", item.details_link)