Define TestSocketInet class

doing helper_startup.fixSocket() in setUpClass - to be inherited by
any test case using protocol.encodeHost().
This commit is contained in:
Lee Miller 2022-04-17 15:09:07 +03:00
parent d41503ee8a
commit a3214b8eea
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63
2 changed files with 9 additions and 4 deletions

View File

@ -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):

View File

@ -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'