Skip to content

Commit

Permalink
[OpenWisp] Ensured tun vpn are ignored #18
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Nov 23, 2015
1 parent 35c296b commit f0f7cb1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/openwisp/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import unittest
import tarfile
from copy import deepcopy

from netjsonconfig import OpenWisp
from netjsonconfig.exceptions import ValidationError
Expand Down Expand Up @@ -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')

0 comments on commit f0f7cb1

Please sign in to comment.