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