Refactor conditions #14

Merged
jonbranan merged 3 commits from refactor-conditions into main 2022-08-31 11:03:39 -05:00
2 changed files with 48 additions and 7 deletions
Showing only changes of commit 4cd1c519e2 - Show all commits

View File

@ -32,7 +32,7 @@ def torprocessor(self):
if self.use_log: if self.use_log:
self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion.') self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion.')
else: else:
dragnet(self, canidate['state'],canidate['ratio'],canidate["tags"],canidate['added_on'],self.age,self.t.time(),canidate['infohash_v1'],canidate["name"][0:20]) dragnet(canidate['state'],canidate['ratio'],canidate["tags"],canidate['added_on'],self.age,self.t.time(),canidate['infohash_v1'],canidate["name"][0:20])
self.tl.info(f'["{canidate["name"][0:20]}..."] is orphaned.') self.tl.info(f'["{canidate["name"][0:20]}..."] is orphaned.')
self.up_tor_counter += 1 self.up_tor_counter += 1
continue continue
@ -69,5 +69,5 @@ def isnonprotectedtor(setnonprotectedtag, tortags):
if setnonprotectedtag in tortags: if setnonprotectedtag in tortags:
return True return True
def dragnet(self,state,ratio,tags,added,age,time,thash,tname): def dragnet(state,ratio,tags,added,age,time,thash,tname):
pass pass

View File

@ -1,5 +1,6 @@
import unittest import unittest
from qlist import ispreme,iscatignored,istrackerblank,isprotectedtracker from qlist import ispreme,iscatignored,istrackerblank,isprotectedtracker,isnotprotectedtracker,istagblank
from qprocess import isdownloading,isprotectedunderratio,isoldtor,isprotectedoverratio,isnonprotectedtor
class TestQbitmaid(unittest.TestCase): class TestQbitmaid(unittest.TestCase):
def test_ispreme_sanity(self): def test_ispreme_sanity(self):
@ -38,19 +39,59 @@ class TestQbitmaid(unittest.TestCase):
pass pass
def test_isnotprotectedtracker_sanity(self): def test_isnotprotectedtracker_sanity(self):
pass self.assertFalse(isnotprotectedtracker('https://a.com/',['a.com','b.me','c.io']))
self.assertTrue(isnotprotectedtracker('https://google.com/',['a.com','b.me','c.io']))
self.assertTrue(isnotprotectedtracker('https://d.com',['a.com','b.me','c.io']))
def test_isnotprotectedtracker(self): def test_isnotprotectedtracker(self):
pass pass
def test_istagblank(self): def test_istagblank(self):
self.assertTrue(istagblank(''))
self.assertFalse(istagblank('a'))
self.assertFalse(istagblank(1))
self.assertFalse(istagblank(1.0001))
self.assertFalse(istagblank(False))
self.assertFalse(istagblank(True))
def test_isdownloading_sanity(self):
self.assertTrue(isdownloading('downloading'))
def test_isdownloading(self):
self.assertFalse(isdownloading('DOWNLOADING'))
self.assertFalse(isdownloading('dOwNlOaDiNg'))
def test_isprotectedunderratio_sanity(self):
self.assertTrue(isprotectedunderratio(0.5,1,'a','a,b,c'))
def test_isprotectedunderratio(self):
pass pass
def test_(self): def test_isoldtor_sanity(self):
self.assertTrue(isoldtor(1,2,4))
def test_isoldtor(self):
pass pass
def test_(self): def test_isprotectedoverratio_sanity(self):
self.assertTrue(isprotectedoverratio(2,1,'a','a,b,c'))
def test_isprotectedoverratio(self):
pass pass
def test_isnonprotectedtor_sanity(self):
self.assertTrue(isnonprotectedtor('a','a,b,c'))
def test_isnonprotectedtor(self):
pass
pass
# def test__sanity(self):
# pass
# def test_(self):
# pass
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()