Browse Source

fix test files

dev
Falseen 9 years ago
parent
commit
82b5980422
  1. 6
      shadowsocks/common.py
  2. 8
      shadowsocks/encrypt_test.py
  3. 7
      shadowsocks/manager.py

6
shadowsocks/common.py

@ -294,12 +294,12 @@ def test_inet_conv():
def test_parse_header(): def test_parse_header():
assert parse_header(b'\x03\x0ewww.google.com\x00\x50') == \ assert parse_header(b'\x03\x0ewww.google.com\x00\x50') == \
(3, b'www.google.com', 80, 18) (0, b'www.google.com', 80, 18)
assert parse_header(b'\x01\x08\x08\x08\x08\x00\x35') == \ assert parse_header(b'\x01\x08\x08\x08\x08\x00\x35') == \
(1, b'8.8.8.8', 53, 7) (0, b'8.8.8.8', 53, 7)
assert parse_header((b'\x04$\x04h\x00@\x05\x08\x05\x00\x00\x00\x00\x00' assert parse_header((b'\x04$\x04h\x00@\x05\x08\x05\x00\x00\x00\x00\x00'
b'\x00\x10\x11\x00\x50')) == \ b'\x00\x10\x11\x00\x50')) == \
(4, b'2404:6800:4005:805::1011', 80, 19) (0, b'2404:6800:4005:805::1011', 80, 19)
def test_pack_header(): def test_pack_header():

8
shadowsocks/encrypt_test.py

@ -7,10 +7,10 @@ import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
from crypto import rc4_md5 from shadowsocks.crypto import rc4_md5
from crypto import openssl from shadowsocks.crypto import openssl
from crypto import sodium from shadowsocks.crypto import sodium
from crypto import table from shadowsocks.crypto import table
def main(): def main():
print("\n""rc4_md5") print("\n""rc4_md5")

7
shadowsocks/manager.py

@ -207,7 +207,9 @@ def test():
eventloop.TIMEOUT_PRECISION = 1 eventloop.TIMEOUT_PRECISION = 1
def run_server(): def run_server():
config = { config = shell.get_config(True)
config = config.copy()
a_config = {
'server': '127.0.0.1', 'server': '127.0.0.1',
'local_port': 1081, 'local_port': 1081,
'port_password': { 'port_password': {
@ -220,7 +222,8 @@ def test():
'fast_open': False, 'fast_open': False,
'verbose': 2 'verbose': 2
} }
manager = Manager(config) a_config.update(config)
manager = Manager(a_config)
enc.append(manager) enc.append(manager)
manager.run() manager.run()

Loading…
Cancel
Save