def test_00EnableSource(self): Sources(name="Reddit Python", url="https://reddit.com/r/python").add() res = Sources(name="Reddit").findAllByName() if len(res) >= 1: assert True else: assert False
def test_runMigrations(self): d = InitDb() d.runMigrations() s = Sources(name="test", url="www.python.com") s.add() res = s.findAllByName() assert len(res) == 1
def test_02ClearSources(self): Sources().clearTable() res = Sources(name="Youtube").findAllByName() if len(res) == 0: assert True else: assert False
def test_05clearTable(self): Sources().clearTable() s = Sources(name="Sources01") res = s.findAllByName() if len(res) == 0: assert True else: assert False
def test_00EnableSource(self): Sources(name="Instagram tag pokemongo", url="pokemongo").add() res = Sources(name="Instagram").findAllByName() if len(res) >= 1: assert True else: assert False
def test_00EnableSource(self): Sources( name="Youtube LoadingReadyRun", url="https://www.youtube.com/user/loadingreadyrun", ).add() res = Sources(name="Youtube").findAllByName() if len(res) >= 1: assert True else: assert False
def checkReddit(self): for i in self.e.reddit_values: r1 = f"Reddit {i.site}" Sources(name=r1, url=f"https://reddit.com/r/{i.site}").add() if i.icon != "": Icons(site=f"Custom Reddit {i.site}", fileName=i.icon).update() for h in i.hooks: DiscordWebHooks(name=r1, key=h).add()
def test_01add01(self): s = Sources(name="", url="void") s.add() res = s.findAllByName() if res[0].name == "" and res[0].url == "void": s.clearTable() assert True else: assert False
def __init__(self) -> None: self.logger = Logger(__class__) self.uri = "https://www.instagram.com/" self.baseUri = self.uri self.siteName: str = "Instagram" self.links: List[Sources] = list() self.hooks: List[DiscordWebHooks] = list() self.sourceEnabled: bool = False self.outputDiscord: bool = False self.currentLink: Sources = Sources() self.checkEnv(self.siteName) pass
def checkSite(self, siteName: str, siteValues: List[EnvDetails]): for i in siteValues: if siteName == i.name: r1 = i.name elif siteName == "Reddit": r1 = f"{siteName} {i.site}" else: r1 = f"{siteName} {i.name}" Sources(name=r1, url=i.site).add() if i.icon != "": Icons(site=f"Custom {r1}", fileName=i.icon).update() for h in i.hooks: DiscordWebHooks(name=r1, key=h).add()
def checkFinalFantasyXIV(self): if self.e.ffxiv_all == True or self.e.ffxiv_topics == True: Sources( name="Final Fantasy XIV Topics", url="https://na.finalfantasyxiv.com/lodestone/topics/", ).add() if self.e.ffxiv_all == True or self.e.ffxiv_notices == True: Sources( name="Final Fantasy XIV Notices", url="https://na.finalfantasyxiv.com/lodestone/news/category/1", ).add() if self.e.ffxiv_all == True or self.e.ffxiv_maintenance == True: Sources( name="Final Fantasy XIV Maintenance", url="https://na.finalfantasyxiv.com/lodestone/news/category/2", ).add() if self.e.ffxiv_all == True or self.e.ffxiv_updates == True: Sources( name="Final Fantasy XIV Updates", url="https://na.finalfantasyxiv.com/lodestone/news/category/3", ).add() if self.e.ffxiv_all == True or self.e.ffxiv_status == True: Sources( name="Final Fantasy XIV Status", url="https://na.finalfantasyxiv.com/lodestone/news/category/4", ).add() for i in self.e.ffxiv_hooks: DiscordWebHooks(name="Final Fantasy XIV", key=i).add() if self.e.ffxiv_icon != "": Icons(site=f"Custom Final Fantasy XIV", fileName=self.e.ffxiv_icon).update()
def test_05ClearSingle(self): s = Sources(name="demo00", url="") s.add() res0 = s.findAllByName() res0[0].clearSingle() res1 = s.findAllByName() if len(res1) == 0: assert True else: assert False
def test_00init00(self): s = Sources() if s.name == "" and s.url == "": assert True else: assert False
def test_00EnableSource(self): Sources(name="RSS Test", url="http://arstechnica.com").add() res = Sources(name="RSS").findAllByName() if len(res) >= 1: assert True
def isSourceEnabled(self, siteName: str) -> bool: res = Sources(name=siteName).findAllByName() if len(res) >= 1: return True else: return False
def getSourceList(self, siteName: str) -> List[Sources]: l = list() res = Sources(name=siteName).findAllByName() for i in res: l.append(i) return l
def test_00init01(self): s = Sources(name="init01") if s.name == "init01" and s.url == "": assert True else: assert False
def test_00init02(self): s = Sources(url="init02") if s.name == "" and s.url == "init02": assert True else: assert False
def clearOldRecords(self) -> None: # clear our the table cache from last startup Sources().clearTable() DiscordWebHooks().clearTable()