def setUp(self): factory = BeepServerFactory() factory.addProfile(echoprofile) reactor.listenTCP(1976, factory, interface='127.0.0.1') self.client = dummyclient.DummyClient() reactor.iterate()
def test_FR006(self): """Test frame with unstarted channel number""" self.client.sendmsg("MSG 55 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR020(self): """Test frame with too large ansno""" self.client.sendmsg("ANS 0 0 . 0 0 5857483575747\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR003(self): """Test frame with negative channel number""" self.client.sendmsg("MSG -5 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR005(self): """Test frame with non-numeric channel number""" self.client.sendmsg("MSG fred 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR024(self): """Test frame NUL as intermediate""" self.client.sendmsg("NUL 0 0 * 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR001(self): """Test frame with invalid header format""" self.client.sendmsg("test\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg(1) self.assertEqual( data, '' )
def test_FR012(self): """Test frame with too large seqno""" self.client.sendmsg("MSG 0 0 . 75747465674373643 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR013(self): """Test frame with non-numeric seqno""" self.client.sendmsg("MSG 0 0 . fred 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR010(self): """Test frame with invalid more type""" self.client.sendmsg("MSG 0 0 g 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR011(self): """Test frame with negative seqno""" self.client.sendmsg("MSG 0 0 . -84 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR009(self): """Test frame with non-numeric message number""" self.client.sendmsg("MSG 0 fred . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR008(self): """Test frame with too large message number""" self.client.sendmsg("MSG 0 6575488457584834 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR007(self): """Test frame with negative message number""" self.client.sendmsg("MSG 0 -6 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR022(self): """Test frame with missing ansno""" self.client.sendmsg("ANS 0 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_2311000_validGreeting(self): """Test valid greeting""" self.client.sendmsg("RPY 0 0 . 0 51\r\nContent-type: application/beep+xml\r\n\r\n<greeting/>\r\nEND\r\n") reactor.iterate() data = self.client.getmsg(1) self.assertEqual( data, 'RPY 0 0 . 0 117\r\nContent-Type: application/beep+xml\n\n<greeting>\r\n <profile uri="http://www.eigenmagic.com/beep/ECHO"/>\r\n</greeting>\r\nEND\r\n' )
def test_FR023(self): """Test frame ansno in non-ANS frame""" self.client.sendmsg("RPY 0 0 . 0 0 15\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR016(self): """Test frame with too large size""" self.client.sendmsg("MSG 0 0 . 0 574857345839457\r\nhere's some stuff\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR025(self): """Test frame NUL with non-zero size""" self.client.sendmsg("NUL 0 0 . 0 5\r\nhi!\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR017(self): """Test frame with non-numeric size""" self.client.sendmsg("MSG 0 0 . 0 fred\r\nhere's some stuff\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR002(self): """Test frame with invalid type""" self.client.sendmsg("WIZ 0 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR018(self): """Test frame with incorrect size""" self.client.sendmsg("MSG 0 0 . 0 5\r\nhere's some stuff\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR004(self): """Test frame with too large channel number""" self.client.sendmsg("MSG 5564748837473643 0 . 0 0\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR019(self): """Test frame with negative ansno""" self.client.sendmsg("ANS 0 0 . 0 0 -65\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_FR021(self): """Test frame with non-numeric ansno""" self.client.sendmsg("ANS 0 0 . 0 0 fred\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg() self.assertEqual( data, '' )
def test_clientStartAlphaChannel(self): """Test start channel with alpha channel number""" self.client.sendmsg("RPY 0 0 . 0 51\r\nContent-Type: application/beep+xml\r\n\r\n<greeting/>\r\nEND\r\n") reactor.iterate() data = self.client.getmsg(1) self.client.sendmsg('MSG 0 0 . 51 118\r\nContent-Type: application/beep+xml\r\n\r\n<start number="a">\r\n <profile uri="http://iana.org/beep/SASL/OTP"/>\r\n</start>\r\nEND\r\n') reactor.iterate() data = self.client.getmsg(1) self.assertEqual(data, 'ERR 0 0 . 117 106\r\nContent-Type: application/beep+xml\n\n<error code="501">\r\n Requested channel number is invalid.\r\n</error>\r\nEND\r\n')
def test_clientStartEvenChannel(self): """Test start channel with incorrectly even number""" self.client.sendmsg("RPY 0 0 . 0 51\r\nContent-Type: application/beep+xml\r\n\r\n<greeting/>\r\nEND\r\n") reactor.iterate() data = self.client.getmsg(1) self.client.sendmsg('MSG 0 0 . 51 118\r\nContent-Type: application/beep+xml\r\n\r\n<start number="6">\r\n <profile uri="http://iana.org/beep/SASL/OTP"/>\r\n</start>\r\nEND\r\n') reactor.iterate() data = self.client.getmsg(1) self.assertEqual(data, 'ERR 0 0 . 117 96\r\nContent-Type: application/beep+xml\n\n<error code="501">\r\n Syntax Error In Parameters\r\n</error>\r\nEND\r\n')
def test_clientStartChannel(self): """Test start channel with unsupported profile""" self.client.sendmsg("RPY 0 0 . 0 51\r\nContent-Type: application/beep+xml\r\n\r\n<greeting/>\r\nEND\r\n") reactor.iterate() data = self.client.getmsg(1) self.client.sendmsg('MSG 0 0 . 51 118\r\nContent-Type: application/beep+xml\r\n\r\n<start number="1">\r\n <profile uri="http://iana.org/beep/SASL/OTP"/>\r\n</start>\r\nEND\r\n') reactor.iterate() data = self.client.getmsg(1) self.assertEqual(data, 'ERR 0 0 . 117 95\r\nContent-Type: application/beep+xml\n\n<error code="504">\r\n Parameter Not Implemented\r\n</error>\r\nEND\r\n')
def setUp(self): ## We first have to create our test keys import os os.system("python ./createTLSTestKeyCerts.py") factory = TestTLSServerFactory() factory.addProfile(echoprofile) factory.addProfile(tlsprofile) factory.privateKeyFileName = "serverKey.pem" factory.certificateFileName = "serverCert.pem" reactor.listenTCP(1976, factory, interface="127.0.0.1") reactor.iterate()
def test_FR014(self): """Test frame with out of sequence seqno""" self.client.sendmsg("RPY 0 0 . 0 51\r\nContent-type: application/beep+xml\r\n\r\n<greeting/>\r\nEND\r\n") reactor.iterate() self.client.sendmsg("MSG 0 0 . 0 13\r\n<greeting/>\r\nEND\r\n") reactor.iterate() reactor.iterate() data = self.client.getmsg()