A test case for protocol with the test for TCPConnection.local

This commit is contained in:
Dmitri Bogomolov 2020-06-10 00:49:14 +03:00
parent f9dc8eaacf
commit 5805840613
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
"""
Tests for common protocol functions
"""
import unittest
class TestProtocol(unittest.TestCase):
"""Main protocol test case"""
def test_check_local(self):
"""Check the logic of TCPConnection.local"""
from pybitmessage import protocol, state
self.assertTrue(
protocol.checkIPAddress(protocol.encodeHost('127.0.0.1'), True))
self.assertTrue(
protocol.checkIPAddress(protocol.encodeHost('192.168.0.1'), True))
self.assertTrue(
not protocol.checkSocksIP('127.0.0.1')
or state.socksIP)