Ema has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/356620 )

Change subject: Add BGP.parse{KeepAlive,Notification} test cases
......................................................................


Add BGP.parse{KeepAlive,Notification} test cases

Change-Id: I57c71ddd12fe0c9f271debd4dcbda99181025484
---
M pybal/bgp/test/test_bgp.py
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Ema: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pybal/bgp/test/test_bgp.py b/pybal/bgp/test/test_bgp.py
index 5776ee6..c0131af 100644
--- a/pybal/bgp/test/test_bgp.py
+++ b/pybal/bgp/test/test_bgp.py
@@ -242,3 +242,15 @@
         msgdata = bytearray(bytes(update)[bgp.HDR_LEN:])
         msgdata[0] += 66
         self.assertRaises(Exception, self.proto.parseUpdate, msgdata)
+
+    def testParseKeepAlive(self):
+        self.assertRaises(bgp.BadMessageLength, self.proto.parseKeepAlive, b' 
')
+
+    def testParseNotification(self):
+        # Verify whether a valid NOTIFICATION parses correctly
+        msg = (struct.pack('!BB', bgp.ERR_MSG_UPDATE,
+            bgp.ERR_MSG_UPDATE_MALFORMED_ASPATH) + b"Unit test")
+        self.assertEquals(self.proto.parseNotification(msg),
+            (bgp.ERR_MSG_UPDATE, bgp.ERR_MSG_UPDATE_MALFORMED_ASPATH, b"Unit 
test"))
+        # Verify a truncated message raises BadMessageLength
+        self.assertRaises(bgp.BadMessageLength, self.proto.parseNotification, 
b' ')

-- 
To view, visit https://gerrit.wikimedia.org/r/356620
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I57c71ddd12fe0c9f271debd4dcbda99181025484
Gerrit-PatchSet: 6
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: Mark Bergsma <m...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to