tests best practices
This commit is contained in:
47
tests/test_inkycal_todoist.py
Normal file
47
tests/test_inkycal_todoist.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
inkycal_todoist unittest
|
||||
"""
|
||||
import logging
|
||||
import sys
|
||||
import unittest
|
||||
from inkycal.modules import Todoist
|
||||
|
||||
from inkycal.modules.inky_image import Inkyimage
|
||||
from tests import Config
|
||||
preview = Inkyimage.preview
|
||||
merge = Inkyimage.merge
|
||||
|
||||
api_key = Config.TODOIST_API_KEY
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
tests = [
|
||||
{
|
||||
"name": "Todoist",
|
||||
"config": {
|
||||
"size": [400, 1000],
|
||||
"api_key": api_key,
|
||||
"project_filter": None,
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
class TestTodoist(unittest.TestCase):
|
||||
|
||||
def test_generate_image(self):
|
||||
if api_key:
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test) + 1} generating image..')
|
||||
module = Todoist(test)
|
||||
im_black, im_colour = module.generate_image()
|
||||
print('OK')
|
||||
if Config.USE_PREVIEW:
|
||||
preview(merge(im_black, im_colour))
|
||||
else:
|
||||
print('No api key given, omitting test')
|
Reference in New Issue
Block a user