[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: 0.0.44.1-2-gfc59469
X2Go dev team
git-admin at x2go.org
Wed Jan 8 15:26:21 CET 2014
The branch, build-baikal has been updated
via fc594694133f4aee54ec58b7294a640608b1f5eb (commit)
from e90fee4675f0b7d01eba6ff53b44c67f4d8a837f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
test.py | 2 +-
{tests => x2go/tests}/__init__.py | 7 ++
{tests => x2go/tests}/runalltests.py | 10 ++-
x2go/tests/test_printing.py | 135 ++++++++++++++++++++++++++++++++++
4 files changed, 150 insertions(+), 4 deletions(-)
mode change 100644 => 100755 test.py
copy {tests => x2go/tests}/__init__.py (80%)
copy {tests => x2go/tests}/runalltests.py (87%)
mode change 100644 => 100755
create mode 100644 x2go/tests/test_printing.py
The diff of changes is:
diff --git a/test.py b/test.py
old mode 100644
new mode 100755
index 5078684..b27363e
--- a/test.py
+++ b/test.py
@@ -24,5 +24,5 @@ Unit tests for Python X2go.
import os
if __name__ == "__main__":
- os.chdir('tests')
+ os.chdir(os.path.join('x2go', 'tests',))
os.system('./runalltests.py')
diff --git a/tests/__init__.py b/x2go/tests/__init__.py
similarity index 80%
copy from tests/__init__.py
copy to x2go/tests/__init__.py
index ec92a8c..eff0c56 100644
--- a/tests/__init__.py
+++ b/x2go/tests/__init__.py
@@ -17,5 +17,12 @@
# Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import os
+import sys
+base = os.path.join(os.path.split(os.path.split(os.getcwd())[0])[0])
+
+# prepend the X2go path (useful for building new packages)
+sys.path = [ os.path.normpath(base), ] + sys.path
+
import runalltests
import test_printing
diff --git a/tests/runalltests.py b/x2go/tests/runalltests.py
old mode 100644
new mode 100755
similarity index 87%
copy from tests/runalltests.py
copy to x2go/tests/runalltests.py
index 275d2d8..baa907d
--- a/tests/runalltests.py
+++ b/x2go/tests/runalltests.py
@@ -23,9 +23,13 @@ This file is a default test runner as found in ZOPE/Plone products. It works
fine for any kind of Python unit testing---as we do here for Python X2go.
"""
-import os, sys
-base = '/'.join(os.getcwd().split('/')[:-1])
-sys.path.append(os.path.join(base, 'x2go'))
+import os
+import sys
+
+base = os.path.join(os.path.split(os.path.split(os.getcwd())[0])[0])
+
+# prepend the X2go path (useful for building new packages)
+sys.path = [os.path.normpath(base)] + sys.path
import unittest
TestRunner = unittest.TextTestRunner
diff --git a/x2go/tests/test_printing.py b/x2go/tests/test_printing.py
new file mode 100644
index 0000000..bc6f9f0
--- /dev/null
+++ b/x2go/tests/test_printing.py
@@ -0,0 +1,135 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+#
+# Python X2go is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Python X2go is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import sys
+import unittest
+import tempfile
+import time
+
+# Python X2go modules
+import x2go
+
+class TestX2goClientPrinting(unittest.TestCase):
+
+ def test_client_printing_dialog(self):
+ _printing = """\
+[General]
+pdfview=true
+showdialog=true
+[print]
+startcmd=false
+command=lpr
+[view]
+open=true
+command=xpdf
+[CUPS]
+defaultprinter=PDF
+"""
+ tf = tempfile.NamedTemporaryFile()
+ print >> tf, _printing
+ tf.seek(0)
+ p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name, client_instance='DUMMY')
+ self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionDIALOG)
+ tf.close()
+
+ def test_client_printing_pdfview(self):
+ _printing = """\
+[General]
+pdfview=true
+[print]
+startcmd=false
+command=lpr
+[view]
+open=true
+command=xpdf
+[CUPS]
+defaultprinter=PDF
+"""
+ tf = tempfile.NamedTemporaryFile()
+ print >> tf, _printing
+ tf.seek(0)
+ p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
+ self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPDFVIEW)
+ tf.close()
+
+ def test_client_printing_pdfsave(self):
+ _printing = """\
+[General]
+pdfview=true
+[print]
+startcmd=false
+command=lpr
+[view]
+open=false
+command=xpdf
+[CUPS]
+defaultprinter=PDF
+"""
+ tf = tempfile.NamedTemporaryFile()
+ print >> tf, _printing
+ tf.seek(0)
+ p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
+ self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPDFSAVE)
+ tf.close()
+
+ def test_client_printing_print(self):
+ _printing = """\
+[General]
+pdfview=false
+[print]
+startcmd=false
+command=lpr
+[view]
+open=false
+command=xpdf
+[CUPS]
+defaultprinter=PDF
+"""
+ tf = tempfile.NamedTemporaryFile()
+ print >> tf, _printing
+ tf.seek(0)
+ p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
+ self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPRINT)
+ tf.close()
+
+ def test_client_printing_printcmd(self):
+ _printing = """\
+[General]
+pdfview=false
+[print]
+startcmd=true
+command=lpr
+[view]
+open=false
+command=xpdf
+[CUPS]
+defaultprinter=PDF
+"""
+ tf = tempfile.NamedTemporaryFile()
+ print >> tf, _printing
+ tf.seek(0)
+ p_action = x2go.backends.printing.X2goClientPrinting(config_files=tf.name)
+ self.assertEqual(type(p_action.print_action), x2go.printactions.X2goPrintActionPRINTCMD)
+ tf.close()
+
+def test_suite():
+ from unittest import TestSuite, makeSuite
+ suite = TestSuite()
+ suite.addTest(makeSuite(TestX2goClientPrinting))
+ return suite
hooks/post-receive
--
python-x2go.git (Python X2Go Client API)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).
More information about the x2go-commits
mailing list