mirror of
https://github.com/samba-team/samba.git
synced 2025-07-09 20:59:11 +03:00
ndrdump: Move blackbox test to standard python namespace.
This commit is contained in:
@ -23,6 +23,7 @@ import os
|
||||
import ldb
|
||||
import samba
|
||||
from samba import param
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
# Other modules import these two classes from here, for convenience:
|
||||
@ -128,3 +129,15 @@ class ValidNetbiosNameTests(TestCase):
|
||||
|
||||
def test_invalid_characters(self):
|
||||
self.assertFalse(samba.valid_netbios_name("*BLA"))
|
||||
|
||||
|
||||
class BlackboxTestCase(TestCase):
|
||||
"""Base test case for blackbox tests."""
|
||||
|
||||
def check_run(self, line):
|
||||
bindir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../bin"))
|
||||
parts = line.split(" ")
|
||||
if os.path.exists(os.path.join(bindir, parts[0])):
|
||||
parts[0] = os.path.join(bindir, parts[0])
|
||||
line = " ".join(parts)
|
||||
subprocess.check_call(line, shell=True)
|
||||
|
28
source4/scripting/python/samba/tests/blackbox/ndrdump.py
Executable file
28
source4/scripting/python/samba/tests/blackbox/ndrdump.py
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
# Blackbox tests for masktest
|
||||
# Copyright (C) 2008 Andrew Tridgell
|
||||
# Copyright (C) 2008 Andrew Bartlett
|
||||
# based on test_smbclient.sh
|
||||
|
||||
import os
|
||||
from samba.tests import BlackboxTestCase
|
||||
|
||||
data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../../librpc/tests"))
|
||||
|
||||
class NdrDumpTests(BlackboxTestCase):
|
||||
"""Blackbox tests for ndrdump."""
|
||||
|
||||
def data_path(self, name):
|
||||
return os.path.join(data_path_dir, name)
|
||||
|
||||
def test_ndrdump_with_in(self):
|
||||
self.check_run("ndrdump samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
|
||||
|
||||
def test_ndrdump_with_out(self):
|
||||
self.check_run("ndrdump samr samr_CreateUser out %s" % (self.data_path("samr-CreateUser-out.dat")))
|
||||
|
||||
def test_ndrdump_context_file(self):
|
||||
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")))
|
||||
|
||||
def test_ndrdump_with_validate(self):
|
||||
self.check_run("ndrdump --validate samr samr_CreateUser in %s" % (self.data_path("samr-CreateUser-in.dat")))
|
Reference in New Issue
Block a user