svn commit: samba r2728 - in
branches/SAMBA_4_0/source/scripting/swig/torture: .
tpot at samba.org
tpot at samba.org
Tue Sep 28 12:49:06 GMT 2004
Author: tpot
Date: 2004-09-28 12:49:05 +0000 (Tue, 28 Sep 2004)
New Revision: 2728
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/scripting/swig/torture&rev=2728&nolog=1
Log:
Break arg parsing stuff out of samr.py into a standalone program.
Added:
branches/SAMBA_4_0/source/scripting/swig/torture/pytorture
Modified:
branches/SAMBA_4_0/source/scripting/swig/torture/samr.py
Changeset:
Added: branches/SAMBA_4_0/source/scripting/swig/torture/pytorture
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/torture/pytorture 2004-09-28 12:42:03 UTC (rev 2727)
+++ branches/SAMBA_4_0/source/scripting/swig/torture/pytorture 2004-09-28 12:49:05 UTC (rev 2728)
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+from optparse import OptionParser
+
+# Parse command line
+
+parser = OptionParser()
+
+parser.add_option("-b", "--binding", action="store", type="string",
+ dest="binding")
+
+parser.add_option("-d", "--domain", action="store", type="string",
+ dest="domain")
+
+parser.add_option("-u", "--username", action="store", type="string",
+ dest="username")
+
+parser.add_option("-p", "--password", action="store", type="string",
+ dest="password")
+
+(options, args) = parser.parse_args()
+
+if not options.binding:
+ parser.error('You must supply a binding string')
+
+if not options.username or not options.password or not options.domain:
+ parser.error('You must supply a domain, username and password')
+
+binding = options.binding
+domain = options.domain
+username = options.username
+password = options.password
+
+# Run tests
+
+import samr
+samr.runtests(binding, domain, username, password)
Property changes on: branches/SAMBA_4_0/source/scripting/swig/torture/pytorture
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/SAMBA_4_0/source/scripting/swig/torture/samr.py
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/torture/samr.py 2004-09-28 12:42:03 UTC (rev 2727)
+++ branches/SAMBA_4_0/source/scripting/swig/torture/samr.py 2004-09-28 12:49:05 UTC (rev 2728)
@@ -1,9 +1,8 @@
#!/usr/bin/python
-import sys, dcerpc
-from optparse import OptionParser
+import dcerpc
-def test_Connect(handle):
+def test_Connect(pipe):
print 'testing samr_Connect'
@@ -93,7 +92,7 @@
dcerpc.samr_QuerySecurity(pipe, r)
-def test_GetDomPwInfo(pipe, domain):
+def test_GetDomPwInfo(pipe, handle, domain):
print 'testing samr_GetDomPwInfo'
@@ -830,23 +829,23 @@
result = dcerpc.samr_LookupDomain(pipe, r)
- test_GetDomPwInfo(pipe, domain)
+ test_GetDomPwInfo(pipe, connect_handle, domain)
- test_OpenDomain(pipe, handle, result['sid'])
+ test_OpenDomain(pipe, connect_handle, result['sid'])
def test_EnumDomains(pipe, connect_handle):
print 'testing samr_EnumDomains'
r = {}
- r['connect_handle'] = handle
+ r['connect_handle'] = connect_handle
r['resume_handle'] = 0
r['buf_size'] = -1
result = dcerpc.samr_EnumDomains(pipe, r)
for domain in result['sam']['entries']:
- test_LookupDomain(pipe, handle, domain['name']['name'])
+ test_LookupDomain(pipe, connect_handle, domain['name']['name'])
def test_LongInt(pipe):
@@ -858,48 +857,18 @@
result = dcerpc.samr_Connect(pipe, r)
-# Parse command line
+def runtests(binding, domain, username, password):
-parser = OptionParser()
+ print 'Testing SAMR pipe'
-parser.add_option("-b", "--binding", action="store", type="string",
- dest="binding")
+ pipe = dcerpc.pipe_connect(binding,
+ dcerpc.DCERPC_SAMR_UUID, dcerpc.DCERPC_SAMR_VERSION,
+ domain, username, password)
-parser.add_option("-d", "--domain", action="store", type="string",
- dest="domain")
+ test_LongInt(pipe)
-parser.add_option("-u", "--username", action="store", type="string",
- dest="username")
+ handle = test_Connect(pipe)
-parser.add_option("-p", "--password", action="store", type="string",
- dest="password")
+ test_QuerySecurity(pipe, handle)
-(options, args) = parser.parse_args()
-
-if not options.binding:
- parser.error('You must supply a binding string')
-
-if not options.username or not options.password or not options.domain:
- parser.error('You must supply a domain, username and password')
-
-
-binding = options.binding
-domain = options.domain
-username = options.username
-password = options.password
-
-print 'Connecting...'
-
-pipe = dcerpc.pipe_connect(binding,
- dcerpc.DCERPC_SAMR_UUID, dcerpc.DCERPC_SAMR_VERSION,
- domain, username, password)
-
-test_LongInt(pipe)
-
-handle = test_Connect(pipe)
-
-test_QuerySecurity(pipe, handle)
-
-test_EnumDomains(pipe, handle)
-
-print 'Done'
+ test_EnumDomains(pipe, handle)
More information about the samba-cvs
mailing list