summaryrefslogtreecommitdiff
path: root/reconfigure/tests
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:30 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:30 +0200
commitfec1da7e6ea8a3b3b03befa4ff8dd31d539f163d (patch)
treef349cf4e0bf6198660dfc1f0cfeec567b0bb84c5 /reconfigure/tests
parent25d6c405aff4167e801d0a4995083a56160b969e (diff)
Imported Upstream version 0.1.50+git20140603
Diffstat (limited to 'reconfigure/tests')
-rw-r--r--reconfigure/tests/configs/ajenti_tests.py1
-rw-r--r--reconfigure/tests/configs/csf_tests.py37
-rw-r--r--reconfigure/tests/configs/samba_tests.py24
-rw-r--r--reconfigure/tests/configs/supervisor_tests.py1
-rw-r--r--reconfigure/tests/parsers/shell_tests.py20
5 files changed, 77 insertions, 6 deletions
diff --git a/reconfigure/tests/configs/ajenti_tests.py b/reconfigure/tests/configs/ajenti_tests.py
index 66a0526..aa1374b 100644
--- a/reconfigure/tests/configs/ajenti_tests.py
+++ b/reconfigure/tests/configs/ajenti_tests.py
@@ -40,6 +40,7 @@ class AjentiConfigTest (BaseConfigTest):
'ssl': {'certificate_path': '', 'enable': False},
'users': {'test': {
'configs': {'a': {'data': {}, 'name': 'a'}},
+ 'email': None,
'name': 'test',
'password': 'sha512',
'permissions': ['section:Dash']
diff --git a/reconfigure/tests/configs/csf_tests.py b/reconfigure/tests/configs/csf_tests.py
new file mode 100644
index 0000000..1d60c27
--- /dev/null
+++ b/reconfigure/tests/configs/csf_tests.py
@@ -0,0 +1,37 @@
+from reconfigure.configs import CSFConfig
+from reconfigure.tests.configs.base_test import BaseConfigTest
+
+
+class CSFConfigTest (BaseConfigTest):
+ sources = {
+ None: """
+TESTING="1"
+TCP_IN="20,21,22,25,53,80,110,143,443,465,587,993,995"
+TCP_OUT="20,21,22,25,53,80,110,113,443"
+UDP_IN="20,21,53"
+UDP_OUT="20,21,53,113,123"
+IPV6="0"
+TCP6_IN="20,21,22,25,53,80,110,143,443,465,587,993,995"
+TCP6_OUT="20,21,22,25,53,80,110,113,443"
+UDP6_IN="20,21,53"
+UDP6_OUT="20,21,53,113,123"
+ETH_DEVICE=""
+ETH6_DEVICE=""
+"""
+ }
+ result = {
+ "tcp6_out": "20,21,22,25,53,80,110,113,443",
+ "testing": True,
+ "eth_device": "",
+ "tcp_in": "20,21,22,25,53,80,110,143,443,465,587,993,995",
+ "tcp6_in": "20,21,22,25,53,80,110,143,443,465,587,993,995",
+ "udp6_in": "20,21,53",
+ "tcp_out": "20,21,22,25,53,80,110,113,443",
+ "udp6_out": "20,21,53,113,123",
+ "ipv6": False,
+ "udp_in": "20,21,53",
+ "eth6_device": "",
+ "udp_out": "20,21,53,113,123"
+ }
+
+ config = CSFConfig
diff --git a/reconfigure/tests/configs/samba_tests.py b/reconfigure/tests/configs/samba_tests.py
index 7a5865c..2604639 100644
--- a/reconfigure/tests/configs/samba_tests.py
+++ b/reconfigure/tests/configs/samba_tests.py
@@ -49,10 +49,16 @@ directory mask=0700
"path": "",
'wide_links': False,
"fstype": "",
- "force_create_mode": "000",
+ "force_create_mode": "000",
"force_directory_mode": "000",
- "veto_files": "",
- "write_list": "",
+ "veto_files": "",
+ "write_list": "",
+ "dfree_command": "",
+ "force_group": "",
+ "force_user": "",
+ "valid_users": "",
+ "read_list": "",
+ "dfree_cache_time": "",
},
{
"name": "profiles",
@@ -66,10 +72,16 @@ directory mask=0700
"path": "/home/samba/profiles",
'wide_links': False,
"fstype": "",
- "force_create_mode": "000",
+ "force_create_mode": "000",
"force_directory_mode": "000",
- "veto_files": "",
- "write_list": "",
+ "veto_files": "",
+ "write_list": "",
+ "dfree_command": "",
+ "force_group": "",
+ "force_user": "",
+ "valid_users": "",
+ "read_list": "",
+ "dfree_cache_time": "",
}
]
}
diff --git a/reconfigure/tests/configs/supervisor_tests.py b/reconfigure/tests/configs/supervisor_tests.py
index b304654..644f78a 100644
--- a/reconfigure/tests/configs/supervisor_tests.py
+++ b/reconfigure/tests/configs/supervisor_tests.py
@@ -16,6 +16,7 @@ command=cat
result = {
"programs": [
{
+ "comment": None,
"autorestart": None,
"name": "test1",
"startsecs": None,
diff --git a/reconfigure/tests/parsers/shell_tests.py b/reconfigure/tests/parsers/shell_tests.py
new file mode 100644
index 0000000..8578d2e
--- /dev/null
+++ b/reconfigure/tests/parsers/shell_tests.py
@@ -0,0 +1,20 @@
+from reconfigure.tests.parsers.base_test import BaseParserTest
+from reconfigure.parsers import ShellParser
+from reconfigure.nodes import *
+
+
+class ShellParserTest (BaseParserTest):
+ parser = ShellParser()
+ source = """
+# The following
+# otherwise they
+PORTS_pop3d="110,995"
+PORTS_htpasswd="80,443" # b
+"""
+ parsed = RootNode(
+ None,
+ PropertyNode('PORTS_pop3d', '110,995', comment='The following\notherwise they'),
+ PropertyNode('PORTS_htpasswd', '80,443', comment='b'),
+ )
+
+del BaseParserTest