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 binascii import unhexlify
|
||||||
from struct import pack
|
from struct import pack
|
||||||
|
|
||||||
from pybitmessage import addresses, protocol
|
from pybitmessage import addresses, protocol
|
||||||
|
|
||||||
from .samples import magic
|
from .samples import magic
|
||||||
|
from .test_protocol import TestSocketInet
|
||||||
|
|
||||||
|
|
||||||
class TestSerialize(unittest.TestCase):
|
class TestSerialize(TestSocketInet):
|
||||||
"""Test serializing and deserializing packet data"""
|
"""Test serializing and deserializing packet data"""
|
||||||
|
|
||||||
def test_varint(self):
|
def test_varint(self):
|
||||||
|
|
|
@ -9,14 +9,18 @@ from pybitmessage import protocol, state
|
||||||
from pybitmessage.helper_startup import fixSocket
|
from pybitmessage.helper_startup import fixSocket
|
||||||
|
|
||||||
|
|
||||||
class TestProtocol(unittest.TestCase):
|
class TestSocketInet(unittest.TestCase):
|
||||||
"""Main protocol test case"""
|
"""Base class for test cases using protocol.encodeHost()"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
"""Execute fixSocket() before start. Only for Windows?"""
|
"""Execute fixSocket() before start. Only for Windows?"""
|
||||||
fixSocket()
|
fixSocket()
|
||||||
|
|
||||||
|
|
||||||
|
class TestProtocol(TestSocketInet):
|
||||||
|
"""Main protocol test case"""
|
||||||
|
|
||||||
def test_checkIPv4Address(self):
|
def test_checkIPv4Address(self):
|
||||||
"""Check the results of protocol.checkIPv4Address()"""
|
"""Check the results of protocol.checkIPv4Address()"""
|
||||||
token = 'HELLO'
|
token = 'HELLO'
|
||||||
|
|
Reference in New Issue
Block a user