コード例 #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')