diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-03-14 16:07:46 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-03-28 09:23:11 +0200 |
commit | 0c25c40315a8255362780486d2f2e27ea0dbbff4 (patch) | |
tree | 0613558fa307e87bdb1b9fc3ff266ba857b83587 | |
parent | e77c18019aef9c98caa0b66cb2e9da5a6f58e600 (diff) | |
download | samba-0c25c40315a8255362780486d2f2e27ea0dbbff4.tar.gz |
selftest: Test server_id database add and removal
This tests indirectly server_id_db_lookup() and
server_id_db_prune_name(), as well as the imessaging
and the imessaging python bindings.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12705
-rw-r--r-- | python/samba/tests/messaging.py | 19 | ||||
-rw-r--r-- | selftest/knownfail | 1 |
2 files changed, 14 insertions, 6 deletions
diff --git a/python/samba/tests/messaging.py b/python/samba/tests/messaging.py index 3eeab529527..a70be96edc2 100644 --- a/python/samba/tests/messaging.py +++ b/python/samba/tests/messaging.py @@ -23,6 +23,7 @@ from samba.messaging import Messaging from samba.tests import TestCase from samba.dcerpc.server_id import server_id from samba.ndr import ndr_print +import random class MessagingTests(TestCase): @@ -46,20 +47,26 @@ class MessagingTests(TestCase): for name in x.irpc_all_servers(): self.assertTrue(isinstance(x.irpc_servers_byname(name.name), list)) + def test_unknown_name(self): + x = self.get_context() + self.assertRaises(KeyError, + x.irpc_servers_byname, "samba.messaging test NONEXISTING") + def test_assign_server_id(self): x = self.get_context() self.assertTrue(isinstance(x.server_id, server_id)) - def test_add_name(self): + def test_add_remove_name(self): x = self.get_context() - x.irpc_add_name("samba.messaging test") - name_list = x.irpc_servers_byname("samba.messaging test") + name = "samba.messaging test-%d" % random.randint(1, 1000000) + x.irpc_add_name(name) + name_list = x.irpc_servers_byname(name) self.assertEqual(len(name_list), 1) self.assertEqual(ndr_print(x.server_id), ndr_print(name_list[0])) - x.irpc_remove_name("samba.messaging test") - self.assertEqual([], - x.irpc_servers_byname("samba.messaging test")) + x.irpc_remove_name(name) + self.assertRaises(KeyError, + x.irpc_servers_byname, name) def test_ping_speed(self): server_ctx = self.get_context((0, 1)) diff --git a/selftest/knownfail b/selftest/knownfail index b25038064c3..b609e27c94f 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -319,3 +319,4 @@ ^samba3.smb2.credits.skipped_mid.* ^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dangling_multi_valued_dbcheck ^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dangling_multi_valued_check_missing +^samba.tests.messaging.samba.tests.messaging.MessagingTests.test_add_remove_name
\ No newline at end of file |