@@ -14,6 +14,21 @@ class TestDdns(unittest.TestCase, _TabsMixin):
14
14
"ddns_rundir" : "/var/run/ddns" ,
15
15
"upd_privateip" : False ,
16
16
"use_curl" : False ,
17
+ "providers" : [
18
+ {
19
+ "enabled" : True ,
20
+ "lookup_host" : "myhost.dyndns.org" ,
21
+ "service_name" : "dyndns.org" ,
22
+ "domain" : "myhost.dyndns.org" ,
23
+ "username" : "myuser" ,
24
+ "password" : "mypassword" ,
25
+ "use_logfile" : True ,
26
+ "ip_source" : "interface" ,
27
+ "ip_interface" : "pppoe-xdsl" ,
28
+ "use_syslog" : 2 ,
29
+ "interface" : "xdsl" ,
30
+ }
31
+ ],
17
32
}
18
33
}
19
34
_ddns_uci_global = """package ddns
@@ -25,13 +40,27 @@ class TestDdns(unittest.TestCase, _TabsMixin):
25
40
option ddns_rundir '/var/run/ddns'
26
41
option upd_privateip '0'
27
42
option use_curl '0'
43
+
44
+ config service 'myhost_dyndns_org'
45
+ option enabled '1'
46
+ option lookup_host 'myhost.dyndns.org'
47
+ option service_name 'dyndns.org'
48
+ option domain 'myhost.dyndns.org'
49
+ option username 'myuser'
50
+ option password 'mypassword'
51
+ option use_logfile '1'
52
+ option ip_source 'interface'
53
+ option ip_interface 'pppoe-xdsl'
54
+ option use_syslog '2'
55
+ option interface 'xdsl'
28
56
"""
29
57
30
58
def test_render_ddns_global (self ):
31
- o = OpenWrt (self ._ddns_netjson_global )
59
+ result = OpenWrt (self ._ddns_netjson_global ). render ( )
32
60
expected = self ._tabs (self ._ddns_uci_global )
33
- self .assertEqual (o . render () , expected )
61
+ self .assertEqual (result , expected )
34
62
35
63
def test_parse_ddns_global (self ):
36
- o = OpenWrt (native = self ._ddns_uci_global )
37
- self .assertDictEqual (o .config , self ._ddns_netjson_global )
64
+ result = OpenWrt (native = self ._ddns_uci_global ).config
65
+ expected = self ._ddns_netjson_global
66
+ self .assertDictEqual (result , expected )
0 commit comments