From: Michael Tremer Date: Thu, 21 Jul 2022 10:23:15 +0000 (+0000) Subject: tests: execute: Check if logger returned the correct output X-Git-Tag: 0.9.28~656 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d24e232af55bb95db0a63db470e8d4fa8d369d54;p=pakfire.git tests: execute: Check if logger returned the correct output Signed-off-by: Michael Tremer --- diff --git a/tests/python/execute.py b/tests/python/execute.py index 900d87aae..8c2cc27cb 100755 --- a/tests/python/execute.py +++ b/tests/python/execute.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import logging import os import pakfire import unittest @@ -77,9 +78,13 @@ class Test(unittest.TestCase): def test_execute_logger(self): def log(priority, message): - print("LOG (%s): %s" % (priority, message.rstrip())) + # Priority must be INFO + self.assertEqual(priority, logging.INFO) - self.pakfire.execute(["/command", "lines", "10"], logging_callback=log) + # All lines must be 20 characters long + self.assertEqual(len(message), 20) + + self.pakfire.execute(["/command", "lines", "10", "20"], logging_callback=log) # This is an interactive test which cannot be performed automatically #def test_shell(self):