From 91fbb3dde120555b6aab3cbbad9bcdcc38be8cc2 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Wed, 7 Apr 2021 16:51:55 +0200 Subject: [PATCH] Add boilerplate for unit testing --- djangoldp_webpushnotification/tests/runner.py | 22 +++++++++++++++++++ .../tests/settings_default.py | 11 ++++++++++ .../tests/tests_vapidkeyset.py | 6 +++++ 3 files changed, 39 insertions(+) create mode 100644 djangoldp_webpushnotification/tests/runner.py create mode 100644 djangoldp_webpushnotification/tests/settings_default.py create mode 100644 djangoldp_webpushnotification/tests/tests_vapidkeyset.py diff --git a/djangoldp_webpushnotification/tests/runner.py b/djangoldp_webpushnotification/tests/runner.py new file mode 100644 index 0000000..8e2d619 --- /dev/null +++ b/djangoldp_webpushnotification/tests/runner.py @@ -0,0 +1,22 @@ +import sys + +import django +import yaml +from django.conf import settings as django_settings +from djangoldp.conf.ldpsettings import LDPSettings +from djangoldp_webpushnotification.tests.settings_default import yaml_config + +config = yaml.safe_load(yaml_config) +ldpsettings = LDPSettings(config) +django_settings.configure(ldpsettings) + +django.setup() +from django.test.runner import DiscoverRunner + +test_runner = DiscoverRunner(verbosity=1) + +failures = test_runner.run_tests([ + 'djangoldp_webpushnotification.tests.tests_vapidkeyset', +]) +if failures: + sys.exit(failures) diff --git a/djangoldp_webpushnotification/tests/settings_default.py b/djangoldp_webpushnotification/tests/settings_default.py new file mode 100644 index 0000000..7a3bc08 --- /dev/null +++ b/djangoldp_webpushnotification/tests/settings_default.py @@ -0,0 +1,11 @@ +"""YAML configurations for djangoldp_webpushnotification testing.""" + +yaml_config = """ +dependencies: + +ldppackages: + - djangoldp_webpushnotification.tests + +server: + INSTALLED_APPS: [] +""" diff --git a/djangoldp_webpushnotification/tests/tests_vapidkeyset.py b/djangoldp_webpushnotification/tests/tests_vapidkeyset.py new file mode 100644 index 0000000..006d74a --- /dev/null +++ b/djangoldp_webpushnotification/tests/tests_vapidkeyset.py @@ -0,0 +1,6 @@ +from django.test import TestCase + + +class TestRSAKey(TestCase): + def test_foobar(self): + assert 2 == 2