2 # Blackbox tests for ndrdump
3 # Copyright (C) 2008 Andrew Tridgell <tridge@samba.org>
4 # Copyright (C) 2008 Andrew Bartlett <abartlet@samba.org>
5 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
6 # based on test_smbclient.sh
8 """Blackbox tests for ndrdump."""
11 from samba.tests import BlackboxTestCase
13 for p in [ "../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
14 data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
16 if os.path.exists(data_path_dir):
20 class NdrDumpTests(BlackboxTestCase):
21 """Blackbox tests for ndrdump."""
23 def data_path(self, name):
24 return os.path.join(data_path_dir, name)
26 def test_ndrdump_with_in(self):
27 self.check_run("ndrdump samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
29 def test_ndrdump_with_out(self):
30 self.check_run("ndrdump samr samr_CreateUser out %s" % (self.data_path("samr-CreateUser-out.dat")))
32 def test_ndrdump_context_file(self):
33 self.check_run("ndrdump --context-file %s samr samr_CreateUser out %s" % (self.data_path("samr-CreateUser-in.dat"), self.data_path("samr-CreateUser-out.dat")))
35 def test_ndrdump_with_validate(self):
36 self.check_run("ndrdump --validate samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))