]> code.delx.au - proxy/blobdiff - test_proxy.py
Makefile cleanups
[proxy] / test_proxy.py
index 5f0a70f89211166e31ec2af75229eef5fa5e56e9..a27c14aa10d245e607d5242655cd4d1722d050e3 100755 (executable)
@@ -151,6 +151,10 @@ class TestRequestNegotiation(SocketHelper, unittest.TestCase):
         self.send(b"\x05\x01\x00\x03\x09localhost" + ECHO_PORT_B)
         self.assertRequestSuccess()
 
+    def test_dns_remote_success(self):
+        self.send(b"\x05\x01\x00\x03\x0bexample.com\x00P")
+        self.assertRequestSuccess()
+
     def test_dns_bad_port(self):
         self.send(b"\x05\x01\x00\x03\x09localhost\xff\xff")
         self.assertRequestFail(4)
@@ -286,8 +290,7 @@ class TestPermissions(SocketHelper, unittest.TestCase):
         try:
             self.init_socket()
             self.send(b"\x05\x01\x00")
-            self.assertAuthSuccess()
-            self.fail("Expected ConnectionResetError")
+            self.assertEnd()
         except ConnectionResetError:
             pass
         finally:
@@ -366,13 +369,13 @@ class SocksServer(object):
         self.env = {}
         self.env["LISTEN_PORT"] = str(SOCKS_PORT)
         self.env.update(extra_env)
-        self.devnull = open("/dev/null", "w")
+        self.log_output = open("out.log", "a")
 
     def __enter__(self):
         self.process = subprocess.Popen(
             args=["./socks5server"],
-            stdout=self.devnull,
-            stderr=self.devnull,
+            stdout=self.log_output,
+            stderr=self.log_output,
             env=self.env,
         )
 
@@ -381,7 +384,7 @@ class SocksServer(object):
         return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
-        self.devnull.close()
+        self.log_output.close()
         self.process.terminate()
         self.process.wait()