Skip to content

Commit 6200b7a

Browse files
committed
[Template] Fixed auto_client bug
1 parent f5fb628 commit 6200b7a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

openwisp_controller/config/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class Meta(AbstractTemplate.Meta):
142142

143143
def clean(self):
144144
self._validate_org_relation('vpn')
145+
super(Template, self).clean()
145146

146147

147148
class Vpn(ShareableOrgMixin, AbstractVpn):

openwisp_controller/config/tests/test_template.py

+12
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ def test_org_default_shared_template(self):
7070
self.assertEqual(c1.templates.count(), 2)
7171
self.assertEqual(c1.templates.filter(name='t1').count(), 1)
7272
self.assertEqual(c1.templates.filter(name='t2').count(), 1)
73+
74+
def test_auto_client_template(self):
75+
org = self._create_org()
76+
vpn = self._create_vpn(organization=org)
77+
t = self._create_template(name='autoclient',
78+
organization=org,
79+
type='vpn',
80+
auto_cert=True,
81+
vpn=vpn,
82+
config={})
83+
control = t.vpn.auto_client()
84+
self.assertDictEqual(t.config, control)

0 commit comments

Comments
 (0)