1 # Blackbox tests for ndrdump
2 # Copyright (C) 2008 Andrew Tridgell <tridge@samba.org>
3 # Copyright (C) 2008 Andrew Bartlett <abartlet@samba.org>
4 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
5 # based on test_smbclient.sh
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 """Blackbox tests for ndrdump."""
24 from samba
.tests
import BlackboxTestCase
26 for p
in [ "../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
27 data_path_dir
= os
.path
.abspath(os
.path
.join(os
.path
.dirname(__file__
), p
))
29 if os
.path
.exists(data_path_dir
):
33 class NdrDumpTests(BlackboxTestCase
):
34 """Blackbox tests for ndrdump."""
36 def data_path(self
, name
):
37 return os
.path
.join(data_path_dir
, name
)
39 def test_ndrdump_with_in(self
):
40 self
.check_run("ndrdump samr samr_CreateUser in %s" % (self
.data_path("samr-CreateUser-in.dat")))
42 def test_ndrdump_with_out(self
):
43 self
.check_run("ndrdump samr samr_CreateUser out %s" % (self
.data_path("samr-CreateUser-out.dat")))
45 def test_ndrdump_context_file(self
):
46 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")))
48 def test_ndrdump_with_validate(self
):
49 self
.check_run("ndrdump --validate samr samr_CreateUser in %s" % (self
.data_path("samr-CreateUser-in.dat")))