def _versionTest(self, serverVersionResponse): """ Test L{NotificationClient} version negotiation. """ self.client.factory.userHandle = "foo" transport = StringTransport() self.client.makeConnection(transport) self.assertEquals(transport.value(), "VER 1 MSNP8 CVR0\r\n") transport.clear() self.client.dataReceived(serverVersionResponse) self.assertEquals( transport.value(), "CVR 2 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS foo\r\n")
def _versionTest(self, serverVersionResponse): """ Test L{NotificationClient} version negotiation. """ self.client.factory.userHandle = "foo" transport = StringTransport() self.client.makeConnection(transport) self.assertEquals( transport.value(), "VER 1 MSNP8 CVR0\r\n") transport.clear() self.client.dataReceived(serverVersionResponse) self.assertEquals( transport.value(), "CVR 2 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS foo\r\n")
def test_challenge(self): """ L{NotificationClient} responds to a I{CHL} message by sending a I{QRY} back which included a hash based on the parameters of the I{CHL}. """ transport = StringTransport() self.client.makeConnection(transport) transport.clear() challenge = "15570131571988941333" self.client.dataReceived('CHL 0 ' + challenge + '\r\n') # md5 of the challenge and a magic string defined by the protocol response = "8f2f5a91b72102cd28355e9fc9000d6e" # Sanity check - the response is what the comment above says it is. self.assertEquals(response, md5(challenge + "Q1P7W2E4J9R8U3S5").hexdigest()) self.assertEquals( transport.value(), # 2 is the next transaction identifier. 32 is the length of the # response. "QRY 2 [email protected] 32\r\n" + response)
def test_challenge(self): """ L{NotificationClient} responds to a I{CHL} message by sending a I{QRY} back which included a hash based on the parameters of the I{CHL}. """ transport = StringTransport() self.client.makeConnection(transport) transport.clear() challenge = "15570131571988941333" self.client.dataReceived('CHL 0 ' + challenge + '\r\n') # md5 of the challenge and a magic string defined by the protocol response = "8f2f5a91b72102cd28355e9fc9000d6e" # Sanity check - the response is what the comment above says it is. self.assertEquals( response, md5(challenge + "Q1P7W2E4J9R8U3S5").hexdigest()) self.assertEquals( transport.value(), # 2 is the next transaction identifier. 32 is the length of the # response. "QRY 2 [email protected] 32\r\n" + response)