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 @@ -43,3 +43,39 @@ def test_check_local(self):
4343 self .assertTrue (
4444 not protocol .checkSocksIP ('127.0.0.1' )
4545 or state .socksIP )
46+
47+ def test_network_group (self ):
48+ """Test various types of network groups"""
49+
50+ test_ip = '1.2.3.4'
51+ self .assertEqual (b'\x01 \x02 ' , protocol .network_group (test_ip ))
52+
53+ test_ip = '127.0.0.1'
54+ self .assertEqual ('IPv4' , protocol .network_group (test_ip ))
55+
56+ self .assertEqual (
57+ protocol .network_group ('8.8.8.8' ),
58+ protocol .network_group ('8.8.4.4' ))
59+ self .assertNotEqual (
60+ protocol .network_group ('1.1.1.1' ),
61+ protocol .network_group ('8.8.8.8' ))
62+
63+ test_ip = '0102:0304:0506:0708:090A:0B0C:0D0E:0F10'
64+ self .assertEqual (
65+ b'\x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0A \x0B \x0C ' ,
66+ protocol .network_group (test_ip ))
67+
68+ test_ip = 'bootstrap8444.bitmessage.org'
69+ self .assertEqual (
70+ 'bootstrap8444.bitmessage.org' ,
71+ protocol .network_group (test_ip ))
72+
73+ test_ip = 'quzwelsuziwqgpt2.onion'
74+ self .assertEqual (
75+ test_ip ,
76+ protocol .network_group (test_ip ))
77+
78+ test_ip = None
79+ self .assertEqual (
80+ None ,
81+ protocol .network_group (test_ip ))
You can’t perform that action at this time.
0 commit comments