1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Use new style python classes.

(This used to be commit 2a39aae0ce)
This commit is contained in:
Jelmer Vernooij 2008-08-01 21:00:09 +02:00
parent fff006bd84
commit 1c94f3e95d
9 changed files with 27 additions and 12 deletions

View File

@ -53,7 +53,7 @@ class InvalidNetbiosName(Exception):
super(InvalidNetbiosName, self).__init__("The name '%r' is not a valid NetBIOS name" % name)
class ProvisionPaths:
class ProvisionPaths(object):
def __init__(self):
self.shareconf = None
self.hklm = None
@ -77,7 +77,8 @@ class ProvisionPaths:
self.fedoradsinf = None
self.fedoradspartitions = None
class ProvisionNames:
class ProvisionNames(object):
def __init__(self):
self.rootdn = None
self.domaindn = None
@ -92,7 +93,8 @@ class ProvisionNames:
self.sitename = None
self.smbconf = None
class ProvisionResult:
class ProvisionResult(object):
def __init__(self):
self.paths = None
self.domaindn = None

View File

@ -308,7 +308,7 @@ class ShareInfoDatabase(TdbDatabase):
return secdesc
class Shares:
class Shares(object):
"""Container for share objects."""
def __init__(self, lp, shareinfo):
self.lp = lp
@ -371,7 +371,7 @@ def decode_acb(text):
return ret
class SAMUser:
class SAMUser(object):
"""Samba 3 SAM User.
:note: Unknown or unset fields are set to None.
@ -421,7 +421,8 @@ class SAMUser:
return False
return self.__dict__ == other.__dict__
class SmbpasswdFile:
class SmbpasswdFile(object):
"""Samba 3 smbpasswd file reader."""
def __init__(self, file):
self.users = {}
@ -482,7 +483,7 @@ TDBSAM_FORMAT_STRING_V2 = "dddddddBBBBBBBBBBBBddBBBwwdBwwd"
TDBSAM_USER_PREFIX = "USER_"
class LdapSam:
class LdapSam(object):
"""Samba 3 LDAP passdb backend reader."""
def __init__(self, url):
self.ldap_url = ldap_url
@ -605,7 +606,7 @@ def shellsplit(text):
return ret
class WinsDatabase:
class WinsDatabase(object):
"""Samba 3 WINS database reader."""
def __init__(self, file):
self.entries = {}
@ -643,7 +644,8 @@ class WinsDatabase:
def close(self): # for consistency
pass
class Samba3:
class Samba3(object):
"""Samba 3 configuration and state data reader."""
def __init__(self, libdir, smbconfpath):
"""Open the configuration and data for a Samba 3 installation.

View File

@ -97,7 +97,8 @@ def call_fn(fn, pipe, args):
return result;
class SamrHandle:
class SamrHandle(object):
def __init__(self, pipe, handle):
@ -137,6 +138,7 @@ class SamrHandle:
call_fn(dcerpc.dcerpc_samr_SetSecurity, self.pipe, r)
class ConnectHandle(SamrHandle):
def EnumDomains(self):
@ -212,6 +214,7 @@ class ConnectHandle(SamrHandle):
call_fn(dcerpc.dcerpc_samr_SetBootKeyInformation, self.pipe, r)
class DomainHandle(SamrHandle):
def QueryDomainInfo(self, level = 2):
@ -517,6 +520,7 @@ class DomainHandle(SamrHandle):
call_fn(dcerpc.dcerpc_samr_TestPrivateFunctionsDomain, self.pipe, r)
class UserHandle(SamrHandle):
def DeleteUser(self):
@ -576,6 +580,7 @@ class UserHandle(SamrHandle):
call_fn(dcerpc.dcerpc_samr_TestPrivateFunctionsUser, self.pipe, r)
class GroupHandle(SamrHandle):
def QueryGroupInfo(self, level):
@ -608,6 +613,7 @@ class GroupHandle(SamrHandle):
dcerpc.uint32_array_getitem(r.data_out.rids.unknown, x))
for x in range(r.data_out.rids.count)]
class AliasHandle(SamrHandle):
def DeleteDomAlias(self):

View File

@ -22,6 +22,7 @@ from samba.dcerpc import ClientConnection
from unittest import TestCase
from samba.tests import cmdline_loadparm
class BareTestCase(TestCase):
def test_bare(self):
# Connect to the echo pipe

View File

@ -21,6 +21,7 @@ from samba.dcerpc import winreg
import unittest
from samba.tests import RpcInterfaceTestCase
class WinregTests(RpcInterfaceTestCase):
def setUp(self):
self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(),

View File

@ -22,6 +22,7 @@ from samba.ndr import ndr_pack, ndr_unpack
import unittest
from samba.tests import RpcInterfaceTestCase
class RpcEchoTests(RpcInterfaceTestCase):
def setUp(self):
self.conn = echo.rpcecho("ncalrpc:", self.get_loadparm())
@ -56,6 +57,7 @@ class RpcEchoTests(RpcInterfaceTestCase):
def test_server_name(self):
self.assertEquals(None, self.conn.server_name)
class NdrEchoTests(unittest.TestCase):
def test_info1_push(self):
x = echo.info1()

View File

@ -87,7 +87,7 @@ class FindNssTests(unittest.TestCase):
self.assertEquals("ha", findnss(x, ["bloe", "bla"]))
class Disabled:
class Disabled(object):
def test_setup_templatesdb(self):
raise NotImplementedError(self.test_setup_templatesdb)

View File

@ -153,6 +153,7 @@ class WinsDatabaseTestCase(unittest.TestCase):
def tearDown(self):
self.winsdb.close()
class SmbpasswdTestCase(unittest.TestCase):
def setUp(self):
self.samdb = SmbpasswdFile(os.path.join(DATADIR, "smbpasswd"))

View File

@ -376,7 +376,7 @@ def run_isolated(klass, self, result):
return result
class SubunitTestRunner:
class SubunitTestRunner(object):
def __init__(self, stream=sys.stdout):
self.stream = stream