diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..26f49b4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,19 @@ +import logging +from unittest import TestCase # noqa: F401 + + +def patch_deprecation_warning(): + original_logger = logging.getLogger("brother_ql.devicedependent").warning + + def warn(message, *args, **kwargs): + if ( + message + == "deprecation warning: brother_ql.devicedependent is deprecated and will be removed in a future release" # noqa: E501 + ): + return + original_logger(message, *args, **kwargs) + + logging.getLogger("brother_ql.devicedependent").warn = warn + + +patch_deprecation_warning() diff --git a/tests/test_cli.py b/tests/test_cli.py index 86c24f1..af830c6 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,8 +1,18 @@ -from unittest import TestCase +from tests import TestCase # Silence useless deprecation warning. + +from brother_ql_web import cli class LogLevelTypeTestCase(TestCase): - pass + def test_valid(self): + self.assertEqual(40, cli.log_level_type("ERROR")) + self.assertEqual(40, cli.log_level_type("error")) + + def test_invalid(self): + with self.assertRaisesRegex( + AttributeError, "^module 'logging' has no attribute 'XYZ'$" + ): + cli.log_level_type("xyz") class GetParametersTestCase(TestCase): diff --git a/tests/test_configuration.py b/tests/test_configuration.py index e69de29..420ba88 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -0,0 +1,25 @@ +from unittest import TestCase + + +class ConfigurationTestCase(TestCase): + pass + + +class ServerConfigurationTestCase(TestCase): + pass + + +class PrinterConfigurationTestCase(TestCase): + pass + + +class FontTestCase(TestCase): + pass + + +class LabelConfigurationTestCase(TestCase): + pass + + +class WebsiteConfigurationTestCase(TestCase): + pass diff --git a/tests/test_font_helpers.py b/tests/test_font_helpers.py index e69de29..5b81cd6 100644 --- a/tests/test_font_helpers.py +++ b/tests/test_font_helpers.py @@ -0,0 +1,5 @@ +from unittest import TestCase + + +class GetFontsTestCase(TestCase): + pass diff --git a/tests/test_labels.py b/tests/test_labels.py index e69de29..196b822 100644 --- a/tests/test_labels.py +++ b/tests/test_labels.py @@ -0,0 +1,29 @@ +from unittest import TestCase + + +class LabelParametersTestCase(TestCase): + pass + + +class DetermineImageDimensionsTestCase(TestCase): + pass + + +class DetermineTextOffsetsTestCase(TestCase): + pass + + +class CreateLabelImageTestCase(TestCase): + pass + + +class ImageToPngBytesTestCase(TestCase): + pass + + +class GenerateLabelTestCase(TestCase): + pass + + +class PrintLabelTestCase(TestCase): + pass diff --git a/tests/test_main.py b/tests/test_main.py index e69de29..67c2e31 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -0,0 +1,5 @@ +from unittest import TestCase + + +class MainTestCase(TestCase): + pass diff --git a/tests/test_utils.py b/tests/test_utils.py index e69de29..20ce847 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -0,0 +1,13 @@ +from unittest import TestCase + + +class CollectFontsTestCase(TestCase): + pass + + +class GetLabelSizesTestCase(TestCase): + pass + + +class GetBackendClassTestCase(TestCase): + pass diff --git a/tests/test_web.py b/tests/test_web.py index e69de29..c44c555 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -0,0 +1,33 @@ +from unittest import TestCase + + +class GetConfigTestCase(TestCase): + pass + + +class IndexTestCase(TestCase): + pass + + +class ServeStaticTestCase(TestCase): + pass + + +class LabeldesignerTestCase(TestCase): + pass + + +class GetLabelParametersTestCase(TestCase): + pass + + +class GetPreviewImageTestCase(TestCase): + pass + + +class PrintTextTestCase(TestCase): + pass + + +class MainTestCase(TestCase): + pass