build: Change bin/default/python -> bin/python symlink to bin/default/python_modules
[metze/samba/wip.git] / python / samba / tests / blackbox / ndrdump.py
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
6
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.
11 #
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.
16 #
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/>.
19 #
20
21 """Blackbox tests for ndrdump."""
22
23 import os
24 from samba.tests import BlackboxTestCase
25
26 for p in [ "../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
27     data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
28     print data_path_dir
29     if os.path.exists(data_path_dir):
30         break
31
32
33 class NdrDumpTests(BlackboxTestCase):
34     """Blackbox tests for ndrdump."""
35
36     def data_path(self, name):
37         return os.path.join(data_path_dir, name)
38
39     def test_ndrdump_with_in(self):
40         self.check_run("ndrdump samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
41
42     def test_ndrdump_with_out(self):
43         self.check_run("ndrdump samr samr_CreateUser out %s" % (self.data_path("samr-CreateUser-out.dat")))
44
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")))
47
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")))