Ejemplo n.º 1
0
    def test_tcps(self):
        address = ('127.0.0.1', 5515)
        
        keyfile = NamedTemporaryFile(delete=False)
        keyfile.write(key_data)
        keyfile.close()
        certfile = NamedTemporaryFile(delete=False)
        certfile.write(cert_data)
        certfile.close()
        serv = SyslogServer(address, Handler, 
            keyfile=keyfile.name,
            certfile=certfile.name)
        serv.entry = None

        thr = threading.Thread(
            target=syslog_server_thread, args=(serv,))
        thr.start()
        tm = TCPSyslogEmitter(address, octet_based_framing=True,
                keyfile=None)
        y = create_test_entry('TCPS')
        tm.emit(y)
        tm.close()
        thr.join()

        serv.socket.close()
        
        os.unlink(keyfile.name)
        os.unlink(certfile.name)

        self.assertEqual(serv.entry.msg, "An application event log entry through TCPS...")
Ejemplo n.º 2
0
    def test_tcps(self):
        address = ('127.0.0.1', 5515)

        keyfile = NamedTemporaryFile(delete=False)
        keyfile.write(key_data)
        keyfile.close()
        certfile = NamedTemporaryFile(delete=False)
        certfile.write(cert_data)
        certfile.close()
        serv = SyslogServer(address,
                            Handler,
                            keyfile=keyfile.name,
                            certfile=certfile.name)
        serv.entry = None

        thr = threading.Thread(target=syslog_server_thread, args=(serv, ))
        thr.start()
        tm = TCPSyslogEmitter(address, octet_based_framing=True, keyfile=None)
        y = create_test_entry('TCPS')
        tm.emit(y)
        tm.close()
        thr.join()

        serv.socket.close()

        os.unlink(keyfile.name)
        os.unlink(certfile.name)

        self.assertEqual(serv.entry.msg,
                         "An application event log entry through TCPS...")
Ejemplo n.º 3
0
    def test_tcp(self):
        address = ('127.0.0.1', 5514)

        serv = SyslogServer(address, Handler)
        serv.entry = None

        thr = threading.Thread(target=syslog_server_thread, args=(serv, ))
        thr.start()
        tm = TCPSyslogEmitter(address, octet_based_framing=False)
        y = create_test_entry('TCP')
        tm.emit(y)
        tm.close()
        thr.join()
        serv.socket.close()

        self.assertEqual(serv.entry.msg,
                         "An application event log entry through TCP...")
Ejemplo n.º 4
0
 def test_tcp(self):
     address = ('127.0.0.1', 5514)
     
     serv = SyslogServer(address, Handler)
     serv.entry = None
     
     thr = threading.Thread(
         target=syslog_server_thread, args=(serv,))
     thr.start()
     tm = TCPSyslogEmitter(address, octet_based_framing=False)
     y = create_test_entry('TCP')
     tm.emit(y)
     tm.close()
     thr.join()
     serv.socket.close()
     
     self.assertEqual(serv.entry.msg, "An application event log entry through TCP...")