diff --git a/tests/openwisp/test_backend.py b/tests/openwisp/test_backend.py index 949462a1b..755639b78 100644 --- a/tests/openwisp/test_backend.py +++ b/tests/openwisp/test_backend.py @@ -1,6 +1,7 @@ import os import unittest import tarfile +from copy import deepcopy from netjsonconfig import OpenWisp from netjsonconfig.exceptions import ValidationError @@ -145,3 +146,16 @@ def test_install_script(self): # close and delete tar.gz file tar.close() os.remove('openwrt-config.tar.gz') + + def test_ensure_tun_vpn_ignored(self): + config = deepcopy(self.config) + config['openvpn'][0]['dev_type'] = 'tun' + o = OpenWisp(config) + o.generate() + tar = tarfile.open('openwrt-config.tar.gz', 'r:gz') + install = tar.getmember('install.sh') + contents = tar.extractfile(install).read().decode() + self.assertNotIn('openvpn --mktun --dev 2693 --dev-type tap', contents) + # close and delete tar.gz file + tar.close() + os.remove('openwrt-config.tar.gz')