selftest.socket_wrapper: Add basic unit tests.
[ira/wip.git] / selftest / tests / test_socket_wrapper.py
1 # test_socket_wraper.py -- The tests for selftest socket wrapper routines
2 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; version 3
7 # of the License or (at your option) any later version of
8 # the License.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # MA  02110-1301, USA.
19
20 """Tests for selftest/socket_wrapper."""
21
22 from selftest import socket_wrapper
23
24 import os
25 import unittest
26
27 class SocketWrapperTests(unittest.TestCase):
28
29     def test_setup_pcap(self):
30         socket_wrapper.setup_pcap("somefile")
31         self.assertEquals("somefile", os.environ["SOCKET_WRAPPER_PCAP_FILE"])
32
33     def test_set_default_iface(self):
34         socket_wrapper.set_default_iface(4)
35         self.assertEquals("4", os.environ["SOCKET_WRAPPER_DEFAULT_IFACE"])