1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-19 10:03:58 +03:00

r3216: Add tests for OpenPrinterEx and ClosePrinter.

This commit is contained in:
Tim Potter 2004-10-25 12:54:52 +00:00 committed by Gerald (Jerry) Carter
parent 6a9e18528c
commit b7ff5f0ded

View File

@ -1,13 +1,56 @@
import string
import dcerpc
def test_OpenPrinterEx(pipe, printer):
print 'testing spoolss_OpenPrinterEx(%s)' % printer
r = {}
r['printername'] = '\\\\win2k3dc\\%s' % printer
r['datatype'] = None
r['devmode_ctr'] = {}
r['devmode_ctr']['size'] = 0
r['devmode_ctr']['devmode'] = None
r['access_mask'] = 0x02000000
r['level'] = 1
r['userlevel'] = {}
r['userlevel']['level1'] = {}
r['userlevel']['level1']['size'] = 0
r['userlevel']['level1']['client'] = None
r['userlevel']['level1']['user'] = None
r['userlevel']['level1']['build'] = 1381
r['userlevel']['level1']['major'] = 2
r['userlevel']['level1']['minor'] = 0
r['userlevel']['level1']['processor'] = 0
result = dcerpc.spoolss_OpenPrinterEx(pipe, r)
return result['handle']
def test_ClosePrinter(pipe, handle):
r = {}
r['handle'] = handle
dcerpc.spoolss_ClosePrinter(pipe, r)
def test_EnumPrinters(pipe):
print 'testing spoolss_EnumPrinters'
printer_names = None
r = {}
r['flags'] = 0x02
r['server'] = None
r['level'] = 1
r['buffer'] = None
for level in [1, 2, 4, 5]:
r['level'] = level
r['buf_size'] = 0
r['buffer'] = None
result = dcerpc.spoolss_EnumPrinters(pipe, r)
@ -17,7 +60,19 @@ def test_EnumPrinters(pipe):
result = dcerpc.spoolss_EnumPrinters(pipe, r)
print dcerpc.unmarshall_spoolss_PrinterInfo_array(result['buffer'], r['level'], result['count'])
printers = dcerpc.unmarshall_spoolss_PrinterInfo_array(
result['buffer'], r['level'], result['count'])
if printer_names is None:
printer_names = map(
lambda x: string.split(x['info1']['name'], ',')[0], printers)
for printer in printer_names:
handle = test_OpenPrinterEx(pipe, printer)
test_ClosePrinter(pipe, handle)
def runtests(binding, domain, username, password):