Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #2919: General Disconnect without getting banned? #2924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions yowsup/layers/coder/test_decoder.py
Expand Up @@ -8,8 +8,8 @@ def setUp(self):
self.decoder.streamStarted = True

def test_decode(self):
data = bytearray([0, 248, 6, 95, 179, 252, 3, 120, 121, 122, 252, 4, 102, 111, 114, 109, 252, 3, 97, 98, 99, 248, 1, 248, 4, 93,
236, 104, 255, 130, 18, 63, 252, 6, 49, 50, 51, 52, 53, 54])
data = bytearray([0, 248, 6, 9, 11, 252, 3, 120, 121, 122, 5, 252, 3, 97, 98, 99, 248, 1, 248, 4, 50, 238, 86, 255, 130, 18, 63,
252, 6, 49, 50, 51, 52, 53, 54])
node = self.decoder.getProtocolTreeNode(data)
targetNode = ProtocolTreeNode("message", {"form": "abc", "to":"xyz"}, [ProtocolTreeNode("media", {"width" : "123"}, data=b"123456")])
targetNode = ProtocolTreeNode("message", {"from": "abc", "to":"xyz"}, [ProtocolTreeNode("media", {"width" : "123"}, data=b"123456")])
self.assertEqual(node, targetNode)
10 changes: 5 additions & 5 deletions yowsup/layers/coder/test_encoder.py
Expand Up @@ -9,14 +9,14 @@ def setUp(self):
self.encoder = WriteEncoder(TokenDictionary())

def test_encode(self):
node = ProtocolTreeNode("message", {"form": "abc", "to":"xyz"}, [ProtocolTreeNode("media", {"width" : "123"}, data=b"123456")])
node = ProtocolTreeNode("message", {"from": "abc", "to":"xyz"}, [ProtocolTreeNode("media", {"width" : "123"}, data=b"123456")])
result = self.encoder.protocolTreeNodeToBytes(node)

self.assertTrue(result in (
[0, 248, 6, 95, 179, 252, 3, 120, 121, 122, 252, 4, 102, 111, 114, 109, 252, 3, 97, 98, 99, 248, 1, 248, 4, 93,
236, 104, 255, 130, 18, 63, 252, 6, 49, 50, 51, 52, 53, 54],
[0, 248, 6, 95, 252, 4, 102, 111, 114, 109, 252, 3, 97, 98, 99, 179, 252, 3, 120, 121, 122, 248, 1, 248, 4, 93,
236, 104, 255, 130, 18, 63, 252, 6, 49, 50, 51, 52, 53, 54]
[0, 248, 6, 9, 11, 252, 3, 120, 121, 122, 5, 252, 3, 97, 98, 99, 248, 1, 248, 4, 50, 238, 86, 255, 130, 18, 63,
252, 6, 49, 50, 51, 52, 53, 54],
[0, 248, 6, 9, 5, 252, 3, 97, 98, 99, 11, 252, 3, 120, 121, 122, 248, 1, 248, 4, 50, 238, 86, 255, 130, 18, 63,
252, 6, 49, 50, 51, 52, 53, 54]
)
)

10 changes: 5 additions & 5 deletions yowsup/layers/coder/test_tokendictionary.py
Expand Up @@ -5,16 +5,16 @@ def setUp(self):
self.tokenDictionary = TokenDictionary()

def test_getToken(self):
self.assertEqual(self.tokenDictionary.getToken(80), "iq")
self.assertEqual(self.tokenDictionary.getToken(10), "iq")

def test_getIndex(self):
self.assertEqual(self.tokenDictionary.getIndex("iq"), (80, False))
self.assertEqual(self.tokenDictionary.getIndex("iq"), (10, False))

def test_getSecondaryToken(self):
self.assertEqual(self.tokenDictionary.getToken(238), "amrnb")
self.assertEqual(self.tokenDictionary.getToken(238), "lc")

def test_getSecondaryTokenExplicit(self):
self.assertEqual(self.tokenDictionary.getToken(11, True), "wmv")
self.assertEqual(self.tokenDictionary.getToken(11, True), "reject")

def test_getSecondaryIndex(self):
self.assertEqual(self.tokenDictionary.getIndex("wmv"), (11, True))
self.assertEqual(self.tokenDictionary.getIndex("reject"), (11, True))