예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 def test_02ClearSources(self):
     Sources().clearTable()
     res = Sources(name="Youtube").findAllByName()
     if len(res) == 0:
         assert True
     else:
         assert False
예제 #4
0
 def test_05clearTable(self):
     Sources().clearTable()
     s = Sources(name="Sources01")
     res = s.findAllByName()
     if len(res) == 0:
         assert True
     else:
         assert False
예제 #5
0
    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
예제 #6
0
    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
예제 #7
0
파일: initdb.py 프로젝트: jtom38/newsbot
 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()
예제 #8
0
    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
예제 #9
0
 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
예제 #10
0
파일: initdb.py 프로젝트: jtom38/newsbot
 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()
예제 #11
0
파일: initdb.py 프로젝트: jtom38/newsbot
    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()
예제 #12
0
 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
예제 #13
0
 def test_00init00(self):
     s = Sources()
     if s.name == "" and s.url == "":
         assert True
     else:
         assert False
예제 #14
0
 def test_00EnableSource(self):
     Sources(name="RSS Test", url="http://arstechnica.com").add()
     res = Sources(name="RSS").findAllByName()
     if len(res) >= 1:
         assert True
예제 #15
0
 def isSourceEnabled(self, siteName: str) -> bool:
     res = Sources(name=siteName).findAllByName()
     if len(res) >= 1:
         return True
     else:
         return False
예제 #16
0
 def getSourceList(self, siteName: str) -> List[Sources]:
     l = list()
     res = Sources(name=siteName).findAllByName()
     for i in res:
         l.append(i)
     return l
예제 #17
0
 def test_00init01(self):
     s = Sources(name="init01")
     if s.name == "init01" and s.url == "":
         assert True
     else:
         assert False
예제 #18
0
 def test_00init02(self):
     s = Sources(url="init02")
     if s.name == "" and s.url == "init02":
         assert True
     else:
         assert False
예제 #19
0
파일: initdb.py 프로젝트: jtom38/newsbot
 def clearOldRecords(self) -> None:
     # clear our the table cache from last startup
     Sources().clearTable()
     DiscordWebHooks().clearTable()