working with test case data
This commit is contained in:
parent
f54702ceb6
commit
06b5016b90
@ -2,6 +2,7 @@
|
|||||||
import qbittorrentapi
|
import qbittorrentapi
|
||||||
import pushover
|
import pushover
|
||||||
from json import load
|
from json import load
|
||||||
|
from json import dump
|
||||||
from qlist import *
|
from qlist import *
|
||||||
from qlogging import *
|
from qlogging import *
|
||||||
from qprocess import *
|
from qprocess import *
|
||||||
@ -66,6 +67,9 @@ class Qbt:
|
|||||||
self.torrentlist = {}
|
self.torrentlist = {}
|
||||||
# Pulling all torrent data
|
# Pulling all torrent data
|
||||||
self.torrentlist = self.qbt_client.torrents_info()
|
self.torrentlist = self.qbt_client.torrents_info()
|
||||||
|
self.d = dump
|
||||||
|
self.l = load
|
||||||
|
writetor(self)
|
||||||
#Main process block
|
#Main process block
|
||||||
#debugpremecal(self)
|
#debugpremecal(self)
|
||||||
if self.use_log:
|
if self.use_log:
|
||||||
|
12
qlogging.py
12
qlogging.py
@ -47,12 +47,15 @@ def getunixtimestamp(self):
|
|||||||
self.uts = self.t.time()
|
self.uts = self.t.time()
|
||||||
self.tl.info(self.uts)
|
self.tl.info(self.uts)
|
||||||
|
|
||||||
def writetor(self, filepath='./torrentinfo.txt'):
|
def writetor(self, filepath='./torrentinfo.json'):
|
||||||
"""Write all torrent data to a file.
|
"""Write all torrent data to a file.
|
||||||
Useful for development of new features.
|
Useful for development of new features.
|
||||||
"""
|
"""
|
||||||
with open(filepath, 'w') as fp:
|
json_init = self.l(self.torrentlist)
|
||||||
fp.write(str(self.torrentlist))
|
print(json_init)
|
||||||
|
# json_object = self.d(self.torrentlist, indent=4)
|
||||||
|
# with open(filepath, 'w') as fp:
|
||||||
|
# fp.write(json_object)
|
||||||
|
|
||||||
def listfirsttor(self, index=0):
|
def listfirsttor(self, index=0):
|
||||||
"""Only lists the first torrent"""
|
"""Only lists the first torrent"""
|
||||||
@ -87,3 +90,6 @@ def getscriptruntime(self):
|
|||||||
self.tl.info(f'Execution time: [{elapsed_time}]')
|
self.tl.info(f'Execution time: [{elapsed_time}]')
|
||||||
if self.use_pushover:
|
if self.use_pushover:
|
||||||
self.extm = f"Execution time: [{elapsed_time}]"
|
self.extm = f"Execution time: [{elapsed_time}]"
|
||||||
|
|
||||||
|
def getobjecttype(object):
|
||||||
|
print(type(object))
|
@ -1,12 +1,18 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from qprocess import torprocessor
|
from qprocess import torprocessor
|
||||||
from json import loads
|
import json
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
class TestQprocess(unittest.TestCase):
|
class TestQprocess(unittest.TestCase):
|
||||||
def test_protected_ratio_below(self):
|
def test_log_and_test_data(self):
|
||||||
self.ti = open("./test/torrentinfo.txt")
|
self.log= logging.getLogger( "SomeTest.testSomething" )
|
||||||
self.tracker_list = loads(self.ti)
|
self.tracker_list = open("./test/torrentinfo.txt", "r")
|
||||||
torprocessor(self)
|
self.log.debug(self.tracker_list)
|
||||||
|
assert self.tracker_list
|
||||||
|
|
||||||
|
# torprocessor(self)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
logging.basicConfig( stream=sys.stderr )
|
||||||
|
logging.getLogger( "SomeTest.testSomething" ).setLevel( logging.DEBUG )
|
||||||
unittest.main()
|
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user