示例#1
0
 def testTypingCheck(self):
     m = msn.MSNMessage()
     m.setHeader('Content-Type', 'text/x-msmsgscontrol')
     m.setHeader('TypingUser', 'foo@bar')
     self.client.checkMessage(m)
     self.failUnless((self.client.state == 'TYPING'),
                     msg='Failed to detect typing notification')
示例#2
0
 def testFileResponse(self):
     d = Deferred()
     d.addCallback(self.fileResponse)
     self.client.cookies['iCookies'][1234] = (d, None)
     m = msn.MSNMessage()
     m.setHeader('Content-Type', 'text/x-msmsgsinvite; charset=UTF-8')
     m.message += 'Invitation-Command: ACCEPT\r\n'
     m.message += 'Invitation-Cookie: 1234\r\n\r\n'
     self.client.checkMessage(m)
     self.failUnless((self.client.state == 'RESPONSE'), msg='Failed to detect file transfer response')
示例#3
0
 def testFileInvitation(self, lazyClient=False):
     m = msn.MSNMessage()
     m.setHeader('Content-Type', 'text/x-msmsgsinvite; charset=UTF-8')
     m.message += 'Application-Name: File Transfer\r\n'
     if not lazyClient:
         m.message += 'Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n'
     m.message += 'Invitation-Command: Invite\r\n'
     m.message += 'Invitation-Cookie: 1234\r\n'
     m.message += 'Application-File: foobar.ext\r\n'
     m.message += 'Application-FileSize: 31337\r\n\r\n'
     self.client.checkMessage(m)
     self.failUnless((self.client.state == 'INVITATION'), msg='Failed to detect file transfer invitation')
示例#4
0
 def testFileInfo(self):
     d = Deferred()
     d.addCallback(self.fileInfo)
     self.client.cookies['external'][1234] = (d, None)
     m = msn.MSNMessage()
     m.setHeader('Content-Type', 'text/x-msmsgsinvite; charset=UTF-8')
     m.message += 'Invitation-Command: ACCEPT\r\n'
     m.message += 'Invitation-Cookie: 1234\r\n'
     m.message += 'IP-Address: 192.168.0.1\r\n'
     m.message += 'Port: 6891\r\n'
     m.message += 'AuthCookie: 4321\r\n\r\n'
     self.client.checkMessage(m)
     self.failUnless((self.client.state == 'INFO'), msg='Failed to detect file transfer info')
示例#5
0
 def testClientCapabilitiesCheck(self):
     m = msn.MSNMessage()
     m.setHeader('Content-Type', 'text/x-clientcaps')
     self.assertEquals(self.client.checkMessage(m), 0, 'Failed to detect client capability message')
示例#6
0
 def gotMessage(self, msg):
     print msg.message.decode('UTF-8').encode(default_locale[1])
     echo = msn.MSNMessage(message=msg.message)
     echo.setHeader('Content-Type', msg.getHeader('Content-Type'))
     self.sendMessage(echo)