PEP8: fix E201: whitespace after '('
[amitay/samba.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 from __future__ import print_function
22 """Blackbox tests for ndrdump."""
23
24 import os
25 from samba.tests import BlackboxTestCase
26
27 for p in ["../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
28     data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
29     print(data_path_dir)
30     if os.path.exists(data_path_dir):
31         break
32
33
34 class NdrDumpTests(BlackboxTestCase):
35     """Blackbox tests for ndrdump."""
36
37     def data_path(self, name):
38         return os.path.join(data_path_dir, name)
39
40     def test_ndrdump_with_in(self):
41         self.check_run("ndrdump samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
42
43     def test_ndrdump_with_out(self):
44         self.check_run("ndrdump samr samr_CreateUser out %s" % (self.data_path("samr-CreateUser-out.dat")))
45
46     def test_ndrdump_context_file(self):
47         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
49     def test_ndrdump_with_validate(self):
50         self.check_run("ndrdump --validate samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
51
52     def test_ndrdump_with_hex(self):
53         self.check_run("ndrdump dns decode_dns_name_packet in --hex-input %s" %
54                        self.data_path("dns-decode_dns_name_packet-hex.dat"))