mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Implemented new matomo setup
This commit is contained in:
@@ -49,7 +49,7 @@ class TestCspFilters(unittest.TestCase):
|
||||
'app2': {}
|
||||
}
|
||||
self.domains = {
|
||||
'matomo': ['matomo.example.org']
|
||||
'web-app-matomo': ['matomo.example.org']
|
||||
}
|
||||
|
||||
def test_get_csp_whitelist_list(self):
|
||||
|
100
tests/unit/filter_plugins/test_docker_service_enabled.py
Normal file
100
tests/unit/filter_plugins/test_docker_service_enabled.py
Normal file
@@ -0,0 +1,100 @@
|
||||
import unittest
|
||||
|
||||
# Import the filter module directly (adjust path as needed)
|
||||
try:
|
||||
from filter_plugins.docker_service_enabled import FilterModule
|
||||
except ModuleNotFoundError:
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../filter_plugins')))
|
||||
from docker_service_enabled import FilterModule
|
||||
|
||||
class TestIsDockerServiceEnabledFilter(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.filter = FilterModule().filters()['is_docker_service_enabled']
|
||||
|
||||
def test_enabled_true(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
'docker': {
|
||||
'services': {
|
||||
'redis': {'enabled': True},
|
||||
'database': {'enabled': True},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertTrue(self.filter(applications, 'app1', 'redis'))
|
||||
self.assertTrue(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
def test_enabled_false(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
'docker': {
|
||||
'services': {
|
||||
'redis': {'enabled': False},
|
||||
'database': {'enabled': False},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'redis'))
|
||||
self.assertFalse(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
def test_missing_enabled_key(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
'docker': {
|
||||
'services': {
|
||||
'redis': {},
|
||||
'database': {},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'redis'))
|
||||
self.assertFalse(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
def test_missing_service_key(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
'docker': {
|
||||
'services': {
|
||||
# no 'redis' or 'database'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'redis'))
|
||||
self.assertFalse(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
def test_missing_services_key(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
'docker': {
|
||||
# no 'services'
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'redis'))
|
||||
|
||||
def test_missing_docker_key(self):
|
||||
applications = {
|
||||
'app1': {
|
||||
# no 'docker'
|
||||
}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
def test_missing_app_id(self):
|
||||
applications = {
|
||||
'other_app': {}
|
||||
}
|
||||
self.assertFalse(self.filter(applications, 'app1', 'redis'))
|
||||
|
||||
def test_applications_is_none(self):
|
||||
applications = None
|
||||
self.assertFalse(self.filter(applications, 'app1', 'database'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@@ -47,8 +47,8 @@ Line three"""
|
||||
self.assertEqual(to_one_liner(s), expected)
|
||||
|
||||
def test_preserve_templating_expressions(self):
|
||||
s = 'var tracker = "//{{ domains | get_domain(\'matomo\') }}/matomo.js"; // loader'
|
||||
expected = 'var tracker = "//{{ domains | get_domain(\'matomo\') }}/matomo.js";'
|
||||
s = 'var tracker = "//{{ domains | get_domain(\'web-app-matomo\') }}/matomo.js"; // loader'
|
||||
expected = 'var tracker = "//{{ domains | get_domain(\'web-app-matomo\') }}/matomo.js";'
|
||||
self.assertEqual(to_one_liner(s), expected)
|
||||
|
||||
def test_mixed_string_and_comment(self):
|
||||
|
Reference in New Issue
Block a user