1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import sys
21 import unittest
22 import tempfile
23 import time
24
25
26 import x2go
27
29
31 _printing = """\
32 [General]
33 pdfview=true
34 showdialog=true
35 [print]
36 startcmd=false
37 command=lpr
38 [view]
39 open=true
40 command=xpdf
41 [CUPS]
42 defaultprinter=PDF
43 """
44 tf = tempfile.NamedTemporaryFile()
45 print >> tf, _printing
46 tf.seek(0)
47 p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name, client_instance='DUMMY')
48 self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionDIALOG)
49 tf.close()
50
52 _printing = """\
53 [General]
54 pdfview=true
55 [print]
56 startcmd=false
57 command=lpr
58 [view]
59 open=true
60 command=xpdf
61 [CUPS]
62 defaultprinter=PDF
63 """
64 tf = tempfile.NamedTemporaryFile()
65 print >> tf, _printing
66 tf.seek(0)
67 p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
68 self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPDFVIEW)
69 tf.close()
70
72 _printing = """\
73 [General]
74 pdfview=true
75 [print]
76 startcmd=false
77 command=lpr
78 [view]
79 open=false
80 command=xpdf
81 [CUPS]
82 defaultprinter=PDF
83 """
84 tf = tempfile.NamedTemporaryFile()
85 print >> tf, _printing
86 tf.seek(0)
87 p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
88 self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPDFSAVE)
89 tf.close()
90
92 _printing = """\
93 [General]
94 pdfview=false
95 [print]
96 startcmd=false
97 command=lpr
98 [view]
99 open=false
100 command=xpdf
101 [CUPS]
102 defaultprinter=PDF
103 """
104 tf = tempfile.NamedTemporaryFile()
105 print >> tf, _printing
106 tf.seek(0)
107 p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
108 self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPRINT)
109 tf.close()
110
112 _printing = """\
113 [General]
114 pdfview=false
115 [print]
116 startcmd=true
117 command=lpr
118 [view]
119 open=false
120 command=xpdf
121 [CUPS]
122 defaultprinter=PDF
123 """
124 tf = tempfile.NamedTemporaryFile()
125 print >> tf, _printing
126 tf.seek(0)
127 p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
128 self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPRINTCMD)
129 tf.close()
130
136