File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from .mock import ConverterTest , SshdAirOs
2+
3+
4+ class TestSshdConverter (ConverterTest ):
5+
6+ backend = SshdAirOs
7+
8+ def test_with_password (self ):
9+ o = self .backend ({
10+ 'sshd' : {
11+ 'port' : 22 ,
12+ 'enabled' : True ,
13+ 'password_auth' : True ,
14+ },
15+ })
16+ o .to_intermediate ()
17+ expected = [
18+ {
19+ 'auth.passwd' : 'enabled' ,
20+ 'port' : 22 ,
21+ 'status' : 'enabled' ,
22+ }
23+ ]
24+ self .assertEqualConfig (o .intermediate_data ['sshd' ], expected )
25+
26+ def test_with_key (self ):
27+ o = self .backend ({
28+ 'sshd' : {
29+ 'port' : 22 ,
30+ 'enabled' : True ,
31+ 'password_auth' : True ,
32+ 'keys' : [
33+ {
34+ 'type' : 'ssh-rsa' ,
35+ 'key' : 'my-public-key-here' ,
36+ 'comment' : 'this is netjsonconfig pubkey' ,
37+ 'enabled' : True ,
38+ }
39+ ]
40+ },
41+ })
42+ o .to_intermediate ()
43+ expected = [
44+ {
45+ 'auth.passwd' : 'enabled' ,
46+ 'auth.key.1.status' : 'enabled' ,
47+ 'auth.key.1.type' : 'ssh-rsa' ,
48+ 'auth.key.1.value' : 'my-public-key-here' ,
49+ 'auth.key.1.comment' : 'this is netjsonconfig pubkey' ,
50+ 'port' : 22 ,
51+ 'status' : 'enabled' ,
52+ }
53+ ]
54+
55+ self .assertEqualConfig (o .intermediate_data ['sshd' ], expected )
You can’t perform that action at this time.
0 commit comments