Define TestSocketInet class
doing helper_startup.fixSocket() in setUpClass - to be inherited by any test case using protocol.encodeHost().
This commit is contained in:
parent
d41503ee8a
commit
a3214b8eea
|
@ -1,14 +1,15 @@
|
|||
"""Test packets creation and parsing"""
|
||||
|
||||
import unittest
|
||||
from binascii import unhexlify
|
||||
from struct import pack
|
||||
|
||||
from pybitmessage import addresses, protocol
|
||||
|
||||
from .samples import magic
|
||||
from .test_protocol import TestSocketInet
|
||||
|
||||
|
||||
class TestSerialize(unittest.TestCase):
|
||||
class TestSerialize(TestSocketInet):
|
||||
"""Test serializing and deserializing packet data"""
|
||||
|
||||
def test_varint(self):
|
||||
|
|
|
@ -9,14 +9,18 @@ from pybitmessage import protocol, state
|
|||
from pybitmessage.helper_startup import fixSocket
|
||||
|
||||
|
||||
class TestProtocol(unittest.TestCase):
|
||||
"""Main protocol test case"""
|
||||
class TestSocketInet(unittest.TestCase):
|
||||
"""Base class for test cases using protocol.encodeHost()"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Execute fixSocket() before start. Only for Windows?"""
|
||||
fixSocket()
|
||||
|
||||
|
||||
class TestProtocol(TestSocketInet):
|
||||
"""Main protocol test case"""
|
||||
|
||||
def test_checkIPv4Address(self):
|
||||
"""Check the results of protocol.checkIPv4Address()"""
|
||||
token = 'HELLO'
|
||||
|
|
Reference in New Issue
Block a user