File tree Expand file tree Collapse file tree 2 files changed +36
-43
lines changed Expand file tree Collapse file tree 2 files changed +36
-43
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -55,3 +55,39 @@ def test_check_local(self):
5555 self .assertTrue (
5656 not protocol .checkSocksIP ('127.0.0.1' )
5757 or state .socksIP )
58+
59+ def test_network_group (self ):
60+ """Test various types of network groups"""
61+
62+ test_ip = '1.2.3.4'
63+ self .assertEqual (b'\x01 \x02 ' , protocol .network_group (test_ip ))
64+
65+ test_ip = '127.0.0.1'
66+ self .assertEqual ('IPv4' , protocol .network_group (test_ip ))
67+
68+ self .assertEqual (
69+ protocol .network_group ('8.8.8.8' ),
70+ protocol .network_group ('8.8.4.4' ))
71+ self .assertNotEqual (
72+ protocol .network_group ('1.1.1.1' ),
73+ protocol .network_group ('8.8.8.8' ))
74+
75+ test_ip = '0102:0304:0506:0708:090A:0B0C:0D0E:0F10'
76+ self .assertEqual (
77+ b'\x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0A \x0B \x0C ' ,
78+ protocol .network_group (test_ip ))
79+
80+ test_ip = 'bootstrap8444.bitmessage.org'
81+ self .assertEqual (
82+ 'bootstrap8444.bitmessage.org' ,
83+ protocol .network_group (test_ip ))
84+
85+ test_ip = 'quzwelsuziwqgpt2.onion'
86+ self .assertEqual (
87+ test_ip ,
88+ protocol .network_group (test_ip ))
89+
90+ test_ip = None
91+ self .assertEqual (
92+ None ,
93+ protocol .network_group (test_ip ))
You can’t perform that action at this time.
0 commit comments