selftest.socket_wrapper: Add basic unit tests.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 00:36:16 +0000 (01:36 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 4 Mar 2012 17:02:06 +0000 (18:02 +0100)
selftest/tests/__init__.py
selftest/tests/test_socket_wrapper.py

index 427c7ce..1e6b192 100644 (file)
@@ -23,10 +23,8 @@ import unittest
 
 def test_suite():
     result = unittest.TestSuite()
-    names = ['socketwrapper']
+    names = ['socket_wrapper']
     module_names = ['selftest.tests.test_' + name for name in names]
     loader = unittest.TestLoader()
     result.addTests(loader.loadTestsFromNames(module_names))
-    from dulwich.tests.compat import test_suite as compat_test_suite
-    result.addTests(compat_test_suite())
     return result
index 0bb2180..1ebdf94 100644 (file)
 # MA  02110-1301, USA.
 
 """Tests for selftest/socket_wrapper."""
+
+from selftest import socket_wrapper
+
+import os
+import unittest
+
+class SocketWrapperTests(unittest.TestCase):
+
+    def test_setup_pcap(self):
+        socket_wrapper.setup_pcap("somefile")
+        self.assertEquals("somefile", os.environ["SOCKET_WRAPPER_PCAP_FILE"])
+
+    def test_set_default_iface(self):
+        socket_wrapper.set_default_iface(4)
+        self.assertEquals("4", os.environ["SOCKET_WRAPPER_DEFAULT_IFACE"])