summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-04 01:36:16 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-04 18:02:06 +0100
commit0cfb8e033c334f7685a6f566b0153b4e435a229d (patch)
treee12887693248c870b36c67b467094837e4563db9
parentadbd55ea5580d5a6a44269f26f7eb6481a40532d (diff)
downloadsamba-0cfb8e033c334f7685a6f566b0153b4e435a229d.tar.gz
samba-0cfb8e033c334f7685a6f566b0153b4e435a229d.tar.bz2
samba-0cfb8e033c334f7685a6f566b0153b4e435a229d.zip
selftest.socket_wrapper: Add basic unit tests.
-rw-r--r--selftest/tests/__init__.py4
-rw-r--r--selftest/tests/test_socket_wrapper.py15
2 files changed, 16 insertions, 3 deletions
diff --git a/selftest/tests/__init__.py b/selftest/tests/__init__.py
index 427c7cee1e..1e6b192d26 100644
--- a/selftest/tests/__init__.py
+++ b/selftest/tests/__init__.py
@@ -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
diff --git a/selftest/tests/test_socket_wrapper.py b/selftest/tests/test_socket_wrapper.py
index 0bb2180ff6..1ebdf94de1 100644
--- a/selftest/tests/test_socket_wrapper.py
+++ b/selftest/tests/test_socket_wrapper.py
@@ -18,3 +18,18 @@
# 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"])