Skip to content

Commit

Permalink
[Template] Fixed auto_client bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed May 24, 2017
1 parent f5fb628 commit 6200b7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions openwisp_controller/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Meta(AbstractTemplate.Meta):

def clean(self):
self._validate_org_relation('vpn')
super(Template, self).clean()


class Vpn(ShareableOrgMixin, AbstractVpn):
Expand Down
12 changes: 12 additions & 0 deletions openwisp_controller/config/tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,15 @@ def test_org_default_shared_template(self):
self.assertEqual(c1.templates.count(), 2)
self.assertEqual(c1.templates.filter(name='t1').count(), 1)
self.assertEqual(c1.templates.filter(name='t2').count(), 1)

def test_auto_client_template(self):
org = self._create_org()
vpn = self._create_vpn(organization=org)
t = self._create_template(name='autoclient',
organization=org,
type='vpn',
auto_cert=True,
vpn=vpn,
config={})
control = t.vpn.auto_client()
self.assertDictEqual(t.config, control)

0 comments on commit 6200b7a

Please sign in to comment.