Permalink
Browse files

[openvpn] Added explicit list_identifiers attribute

  • Loading branch information...
nemesisdesign committed Jun 6, 2017
1 parent 5ddc201 commit dde3c9bbf0564f0f289a58c08c545944265a0b6b
Showing with 18 additions and 1 deletion.
  1. +1 −0 netjsonconfig/backends/openvpn/openvpn.py
  2. +17 −1 tests/openvpn/test_backend.py
@@ -14,6 +14,7 @@ class OpenVpn(BaseBackend):
schema = schema
converters = [converters.OpenVpn]
renderer = OpenVpnRenderer
list_identifiers = ['name']
VPN_REGEXP = re.compile('# openvpn config: ')
def _generate_contents(self, tar):
@@ -200,14 +200,14 @@ def test_client_mode(self):
_simple_conf = {
"openvpn": [{
"name": "test",
"ca": "ca.pem",
"cert": "cert.pem",
"dev": "tap0",
"dev_type": "tap",
"dh": "dh.pem",
"key": "key.pem",
"mode": "server",
"name": "test",
"proto": "udp",
"status": "",
"status_version": 1,
@@ -683,3 +683,19 @@ def test_resolv_retry_invalid(self):
def test_double_rendering(self):
o = OpenVpn(self._simple_conf)
self.assertEqual(o.render(), o.render())
def test_override(self):
template = {
"openvpn": [{
"name": "test",
"ca": "TEST",
"cert": "TEST",
"dev": "TEST",
"dev_type": "TEST",
"dh": "TEST",
"key": "TEST",
}]
}
o = OpenVpn(self._simple_conf, templates=[template])
# ensure dummy values in template have been overridden
self.assertDictEqual(o.config, self._simple_conf)

0 comments on commit dde3c9b

Please sign in to comment.