Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[openwrt] Add test and improve dialup interface type
Signed-off-by: Konrad Kreitmair <kkreitmair@tdt.de>
- Loading branch information
1 parent
acbd54d
commit 9afd432
Showing
5 changed files
with
73 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import unittest | ||
|
||
from netjsonconfig import OpenWrt | ||
from netjsonconfig.utils import _TabsMixin | ||
|
||
|
||
class TestDialup(unittest.TestCase, _TabsMixin): | ||
maxDiff = None | ||
|
||
_dialup_interface_netjson = { | ||
"interfaces": [ | ||
{ | ||
"mtu": 1448, | ||
"network": "xdsl", | ||
"type": "dialup", | ||
"name": "dsl0", | ||
"password": "jf93nf82o023$", | ||
"username": "dsluser", | ||
"proto": "pppoe", | ||
}, | ||
] | ||
} | ||
|
||
_dialup_interface_uci = """package network | ||
config interface 'xdsl' | ||
option ifname 'dsl0' | ||
option mtu '1448' | ||
option password 'jf93nf82o023$' | ||
option proto 'pppoe' | ||
option username 'dsluser' | ||
""" | ||
|
||
def test_render_dialup_interface(self): | ||
result = OpenWrt(self._dialup_interface_netjson).render() | ||
expected = self._tabs(self._dialup_interface_uci) | ||
self.assertEqual(result, expected) | ||
|
||
def test_parse_dialup_interface(self): | ||
result = OpenWrt(native=self._dialup_interface_uci).config | ||
expected = self._dialup_interface_netjson | ||
self.assertDictEqual(result, expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters