Signed-off-by: itoyuichi <[email protected]>
---
 ryu/tests/unit/packet/test_igmp.py |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ryu/tests/unit/packet/test_igmp.py 
b/ryu/tests/unit/packet/test_igmp.py
index e5a810b..75156e8 100644
--- a/ryu/tests/unit/packet/test_igmp.py
+++ b/ryu/tests/unit/packet/test_igmp.py
@@ -17,6 +17,7 @@

 import unittest
 import inspect
+import json
 import logging

 from struct import pack, unpack_from
@@ -50,6 +51,18 @@ class Test_igmp(unittest.TestCase):
         self.g = igmp(self.msgtype, self.maxresp, self.csum,
                       self.address)

+        self.jsonstr = '''
+        {
+            "igmp": {
+                "msgtype": 17,
+                "maxresp": 100,
+                "csum": 0,
+                "address": "225.0.0.1"
+            }
+        }
+        '''
+        self.jsondict = json.loads(self.jsonstr)
+
     def tearDown(self):
         pass

@@ -145,3 +158,10 @@ class Test_igmp(unittest.TestCase):
     def test_malformed_igmp(self):
         m_short_buf = self.buf[1:igmp._MIN_LEN]
         igmp.parser(m_short_buf)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.g.to_jsondict())
+
+    def test_from_jsondict(self):
+        g = igmp.from_jsondict(self.jsondict['igmp'])
+        eq_(str(g), str(self.g))
-- 
1.7.10.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to