ctdb-tests: Add a test for NAT gateway sanity checking
[Samba.git] / lib / tevent / bindings.py
blob1060caf28df36cc322e15a984bb14e45ec17fdfe
1 #!/usr/bin/python
3 # Python integration for tevent - tests
5 # Copyright (C) Jelmer Vernooij 2010
7 # ** NOTE! The following LGPL license applies to the tevent
8 # ** library. This does NOT imply that all of Samba is released
9 # ** under the LGPL
11 # This library is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU Lesser General Public
13 # License as published by the Free Software Foundation; either
14 # version 3 of the License, or (at your option) any later version.
16 # This library is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Lesser General Public License for more details.
21 # You should have received a copy of the GNU Lesser General Public
22 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
24 import signal
25 import _tevent
26 from unittest import TestCase
28 class BackendListTests(TestCase):
30 def test_backend_list(self):
31 self.assertTrue(isinstance(_tevent.backend_list(), list))
34 class CreateContextTests(TestCase):
36 def test_by_name(self):
37 ctx = _tevent.Context(_tevent.backend_list()[0])
38 self.assertTrue(ctx is not None)
40 def test_no_name(self):
41 ctx = _tevent.Context()
42 self.assertTrue(ctx is not None)
45 class ContextTests(TestCase):
47 def setUp(self):
48 super(ContextTests, self).setUp()
49 self.ctx = _tevent.Context()
51 def test_signal_support(self):
52 self.assertTrue(type(self.ctx.signal_support) is bool)
54 def test_reinitialise(self):
55 self.ctx.reinitialise()
57 def test_loop_wait(self):
58 self.ctx.loop_wait()
60 def test_add_signal(self):
61 sig = self.ctx.add_signal(signal.SIGINT, 0, lambda callback: None)
62 self.assertTrue(isinstance(sig, _tevent.Signal))