def test_send(self): sock = Chat(self.sock, line_term = "\r\n") sock.rexpect(ur"^220") sock.send("HELO unittesting") sock.rexpect(ur"^250") sock.send("MAIL FROM: <*****@*****.**>") sock.rexpect(ur"^250") sock.send("RCPT TO: <*****@*****.**>") sock.rexpect(ur"^250") sock.send("DATA") sock.rexpect(ur"^354") sock.send('From: "John Smith" <*****@*****.**>') sock.send('To: "Jane Doe" <*****@*****.**>') sock.send('Subject: test message sent from manual telnet session') sock.send('Date: Wed, 11 May 2011 16:19:57 -0400\r\n') sock.send('Hello World,') sock.send('This is a test message sent from a manual telnet session.\r\n') sock.send('Yours truly,') sock.send('SMTP administrator') sock.send('.') sock.rexpect(ur"^250") sock.send("QUIT") sock.rexpect(ur"^221") self.assertIsNotNone(self.beanstalk.reserve(timeout = 30))
screen.blit(font_render, ((width/2) - 100, (height/2) - 20)) # if connection is ok elif tank.ok: # background screen.blit(pygame.image.load("images/bg.jpg"), (0, 0)) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN: # chat functions if (event.key > 96 and event.key < 123) or event.key == pygame.K_SPACE or event.key == pygame.K_RETURN or event.key == 8: if event.key == pygame.K_RETURN: chat.send() elif event.key == 8: chat.backspace() else: chat.write(event.key) else: # moving if event.key == pygame.K_LEFT: tank.direction = 'left' if event.key == pygame.K_RIGHT: tank.direction = 'right' # shoot if event.key == pygame.K_UP: if len(bullets) < 2: tank.shoot() client.send_bullet(tank.rect.left)