Exemplo n.º 1
0
    def setUp(self):
        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.client = Client()
        self.cli = CLI(self.client)
        self.client.port = str(random.randint(9000, 12000))
        self.server.bind(('localhost', int(self.client.port)))
        self.server.listen(5)
        self.client.tcp.connected = True

        self.client.nick = 'John'
        self.client.tcp.connect(('localhost', int(self.client.port)))
        self.con, addr = self.server.accept()
        self.client.tcp.send(bytes('CONNECT: John Cake Man 1.0.0\r\n'))
        self.data = self.con.recv(1024)
Exemplo n.º 2
0
def main():
    if options.verbose:
        logging.basicConfig(
            level=logging.DEBUG,
            format=
            "%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)s")

    client = Client()

    if options.cli:
        cli = CLI(client)
        cli.main_loop()
    else:
        app = wx.App()
        GUI(None, -1, 'Voix')
        app.MainLoop()
Exemplo n.º 3
0
    def setUp(self):
        self.client = Client()
        self.cli = CLI(self.client)
        self.cli.timeout = 2
        self.cli._testing = True

        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

        self.client.parser.parse('HOST: localhost')
        self.client.port = str(random.randint(9000, 12000))
        self.server.bind(('localhost', int(self.client.port)))
        self.server.listen(5)

        self.client.parser.parse('CONNECT: joe Cake Man')
        self.con, addr = self.server.accept()
        self.data = self.con.recv(1024)
        self.client.tcp.connected = True
Exemplo n.º 4
0
    def setUp(self):
        self.client = Client()
        self.client.host = 'localhost'
        self.client.tcp.connected = True
        self.client.port = str(random.randint(9000, 12000))
        self.cli = CLI(self.client)
        self.cli.timeout = 2

        self.tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.tcpsock.bind(('localhost', int(self.client.port)))
        self.tcpsock.listen(5)

        self.udpsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.udpsock.bind(('localhost', int(self.client.port) + 1))

        self.client.tcp.connect(('localhost', int(self.client.port)))
        self.tcpcon, addr = self.tcpsock.accept()

        wf = wave.open('assets/audio_test/noise.wav')
        self.data = wf.readframes(1024)[:1024]
Exemplo n.º 5
0
 def setUp(self):
     self.client = Client()
     self.parser = Parser(self.client)
     self.mock_parser = mox.Mox()