Skip to content

Commit 3ccef68

Browse files
committed
[airos] added test for sshd converter
1 parent fb00604 commit 3ccef68

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

tests/airos/test_sshd.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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)

0 commit comments

Comments
 (0)