changeset 3:ea08558852e8

Basic tests
author Radomir Dopieralski <radomir.dopieralski@allegro.pl>
date Tue, 26 Jun 2012 12:22:45 +0200
parents 742a29bbda4c
children b1e8f8a90853
files tests/test_dhcp.py
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_dhcp.py	Tue Jun 26 12:22:45 2012 +0200
@@ -0,0 +1,46 @@
+import unittest
+import iscconf
+
+class TestDHCPParsing(unittest.TestCase):
+
+    def setUp(self):
+        self.seq = range(10)
+
+    def test_empty(self):
+        data = iscconf.parse('')
+        self.assertEqual(data, {})
+
+    def test_single(self):
+        data = iscconf.parse("""\
+host s10557.dc2 {
+	fixed-address 10.242.15.6;
+	hardware ethernet 00:1b:78:cf:b3:90;
+}""")
+        self.assertEqual(data, {
+            ('host', 's10557.dc2'): {
+                    ('fixed-address',): '10.242.15.6',
+                    ('hardware', 'ethernet'): '00:1b:78:cf:b3:90',
+                },
+        })
+
+    def test_multi(self):
+        data = iscconf.parse("""\
+host s10557.dc2 {
+	fixed-address 10.242.15.6;
+	hardware ethernet 00:1b:78:cf:b3:90;
+}
+host s10498.dc2 { fixed-address 10.242.15.5; hardware ethernet 00:1a:4b:d0:7c:60; }""")
+        self.assertEqual(data, {
+            ('host', 's10557.dc2'): {
+                    ('fixed-address',): '10.242.15.6',
+                    ('hardware', 'ethernet'): '00:1b:78:cf:b3:90',
+                },
+            ('host', 's10557.dc2'): {
+                    ('fixed-address',): '10.242.15.5',
+                    ('hardware', 'ethernet'): '00:1a:4b:d0:7c:60',
+                },
+        })
+
+
+if __name__ == '__main__':
+    unittest.main()