[X2Go-Commits] x2gobroker.git - build-main (branch) updated: 0.0.1.0-45-g692561e

X2Go dev team git-admin at x2go.org
Sun May 19 13:03:43 CEST 2013


The branch, build-main has been updated
       via  692561e8fe83789863ae6a04e6e4a747f859bc03 (commit)
      from  abc72963617a4c27b376efacbc46cfbe4de4237a (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:
 debian/changelog                           |    3 +-
 etc/broker/x2gobroker-sessionprofiles.conf |    3 +-
 x2gobroker/brokers/zeroconf_broker.py      |    7 +-
 x2gobroker/defaults.py                     |    4 +-
 x2gobroker/tests/test_broker_base.py       |    4 +-
 x2gobroker/tests/test_broker_inifile.py    |  140 +++++++++++++++++++++++-----
 x2gobroker/tests/test_broker_zeroconf.py   |    4 +
 7 files changed, 133 insertions(+), 32 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 39d3dfd..05a9e92 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,7 +20,8 @@ x2gobroker (0.0.1.1-0~x2go1) UNRELEASED; urgency=low
     - Add script: x2gobroker-testauth.
     - Add enable()/disable() methods to broker backends.
     - Move complete authservice logic into x2gobroker-authservice script.
-    - Add cmd and directrdp session profile parameters to defaults.
+    - Add command and directrdp session profile parameters to defaults.
+    - Fix wrong usage of session option »cmd«, has to be »command«.
   * /debian/control:
     + Fix --root parameter in DEB_PYTHON_INSTALL_ARGS.
     + Let bin:package x2gobroker-authservice depend on python-x2gobroker (of the
diff --git a/etc/broker/x2gobroker-sessionprofiles.conf b/etc/broker/x2gobroker-sessionprofiles.conf
index dc79a6b..8031d9e 100644
--- a/etc/broker/x2gobroker-sessionprofiles.conf
+++ b/etc/broker/x2gobroker-sessionprofiles.conf
@@ -29,6 +29,7 @@
 
 
 [DEFAULT]
+command=TERMINAL
 defsndport=true
 useiconv=false
 iconvfrom=UTF-8
@@ -52,7 +53,7 @@ applications=TERMINAL,WWWBROWSER,MAILCLIENT,OFFICE
 multidisp=false
 sshproxyport=22
 sound=true
-rootless=false
+rootless=true
 iconvto=UTF-8
 soundtunnel=true
 dpi=96
diff --git a/x2gobroker/brokers/zeroconf_broker.py b/x2gobroker/brokers/zeroconf_broker.py
index 5970659..6cb83ad 100644
--- a/x2gobroker/brokers/zeroconf_broker.py
+++ b/x2gobroker/brokers/zeroconf_broker.py
@@ -36,7 +36,7 @@ class X2GoBroker(base.X2GoBroker):
 
     def list_profiles(self, username):
 
-        list_of_profiles = {
+        _list_of_profiles = {
             uuid.uuid4(): {
                 'user': u'',
                 'defsndport': True,
@@ -74,6 +74,11 @@ class X2GoBroker(base.X2GoBroker):
                 'pack': u'16m-jpeg',
             },
         }
+        list_of_profiles = {}
+        for profile_id in _list_of_profiles.keys():
+            profile = self.get_profile_defaults()
+            profile.update(_list_of_profiles[profile_id])
+            list_of_profiles[profile_id] = profile
         return list_of_profiles
 
     def select_session(self, profile_id, username=None):
diff --git a/x2gobroker/defaults.py b/x2gobroker/defaults.py
index ca70e82..8d08a33 100644
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -160,7 +160,7 @@ X2GOBROKER_CONFIG_DEFAULTS = {
 # defaults for X2Go Sessino Broker session profiles file
 X2GOBROKER_SESSIONPROFILE_DEFAULTS = {
     u'DEFAULT': {
-        u'cmd': u'TERMINAL',
+        u'command': u'TERMINAL',
         u'defsndport': True,
         u'useiconv': False,
         u'iconvfrom': u'UTF-8',
@@ -184,7 +184,7 @@ X2GOBROKER_SESSIONPROFILE_DEFAULTS = {
         u'multidisp': False,
         u'sshproxyport': 22,
         u'sound': True,
-        u'rootless': False,
+        u'rootless': True,
         u'iconvto': u'UTF-8',
         u'soundtunnel': True,
         u'dpi': 96,
diff --git a/x2gobroker/tests/test_broker_base.py b/x2gobroker/tests/test_broker_base.py
index ac710b8..ff06542 100644
--- a/x2gobroker/tests/test_broker_base.py
+++ b/x2gobroker/tests/test_broker_base.py
@@ -274,7 +274,7 @@ check-credentials = false
     def test_getdefaultprofile(self):
         base_backend = self._init_base_backend()
         _expected_profile = {
-            'cmd': 'TERMINAL',
+            'command': 'TERMINAL',
             'defsndport': True,
             'useiconv': False,
             'iconvfrom': 'UTF-8',
@@ -298,7 +298,7 @@ check-credentials = false
             'multidisp': False,
             'sshproxyport': 22,
             'sound': True,
-            'rootless': False,
+            'rootless': True,
             'iconvto': 'UTF-8',
             'soundtunnel': True,
             'dpi': 96,
diff --git a/x2gobroker/tests/test_broker_inifile.py b/x2gobroker/tests/test_broker_inifile.py
index 35b4289..9d163eb 100644
--- a/x2gobroker/tests/test_broker_inifile.py
+++ b/x2gobroker/tests/test_broker_inifile.py
@@ -47,6 +47,96 @@ class TestX2GoBrokerBackendInifile(unittest.TestCase):
         for _profile_id in _profile_ids:
             self.assertTrue( ( 'default' not in inifile_backend.get_profile(_profile_id).keys() ) )
 
+    # TEST COMPLETION OF DEFAULTS FROM CODE IN defaults.py
+
+    def test_getprofilecompletion(self):
+        _session_profiles = """
+[DEFAULT]
+exports =
+fullscreen = false
+width = 800
+height = 600
+applications = TERMINAL, WWWBROWSER
+
+[testprofile]
+user = foo
+command = GNOME
+
+"""
+        tf = tempfile.NamedTemporaryFile()
+        print >> tf, _session_profiles
+        tf.seek(0)
+        inifile_backend = inifile.X2GoBroker(profile_config_file=tf.name)
+        _expected_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
+        for key in copy.deepcopy(_expected_defaults).keys():
+            if key.startswith('acl-'):
+                del _expected_defaults[key]
+        _expected_defaults.update( {
+            u'exports': '',
+            u'fullscreen': False,
+            u'width': 800,
+            u'height': 600,
+            u'applications': ['TERMINAL','WWWBROWSER',],
+            u'user': 'foo',
+            u'command': 'GNOME',
+        } )
+        # just testing the directrdp hard-coded defaults
+        _expected_defaults.update( {
+            u'directrdp': False,
+        } )
+        _expected_profile = copy.deepcopy(_expected_defaults)
+        _profile = inifile_backend.get_profile('testprofile')
+        print _expected_defaults
+        for key in _expected_profile.keys():
+            self.assertTrue( ( key in _profile.keys() ) )
+        for key in _profile.keys():
+            self.assertTrue( ( key in _expected_profile.keys()  and _profile[key] == _expected_profile[key] ) )
+
+    # TEST COMPLETION OF DEFAULTS FROM CODE IN defaults.py
+
+    def test_getprofilecompletion(self):
+        _session_profiles = """
+[DEFAULT]
+exports =
+fullscreen = false
+width = 800
+height = 600
+applications = TERMINAL, WWWBROWSER
+
+[testprofile]
+user = foo
+command = GNOME
+
+"""
+        tf = tempfile.NamedTemporaryFile()
+        print >> tf, _session_profiles
+        tf.seek(0)
+        inifile_backend = inifile.X2GoBroker(profile_config_file=tf.name)
+        _expected_defaults = copy.deepcopy(x2gobroker.defaults.X2GOBROKER_SESSIONPROFILE_DEFAULTS['DEFAULT'])
+        for key in copy.deepcopy(_expected_defaults).keys():
+            if key.startswith('acl-'):
+                del _expected_defaults[key]
+        _expected_defaults.update( {
+            u'exports': '',
+            u'fullscreen': False,
+            u'width': 800,
+            u'height': 600,
+            u'applications': ['TERMINAL','WWWBROWSER',],
+            u'user': 'foo',
+            u'command': 'GNOME',
+        } )
+        # just testing the directrdp hard-coded defaults
+        _expected_defaults.update( {
+            u'directrdp': False,
+        } )
+        _expected_profile = copy.deepcopy(_expected_defaults)
+        _profile = inifile_backend.get_profile('testprofile')
+        for key in _expected_profile.keys():
+            self.assertTrue( ( key in _profile.keys() ) )
+        for key in _profile.keys():
+            self.assertTrue( ( key in _expected_profile.keys()  and _profile[key] == _expected_profile[key] ) )
+
+
     ### TEST SESSION PROFILES: get_profile_defaults()
 
     def test_getprofiledefaults(self):
@@ -74,16 +164,16 @@ applications = TERMINAL, WWWBROWSER
 
 [testprofile1]
 user = foo
-cmd = GNOME
+command = GNOME
 
 [testprofile2]
 user = bar
-cmd = KDE
+command = KDE
 fullscreen = true
 
 [testprofile3]
 user = bar
-cmd = KDE
+command = KDE
 fullscreen = true
 acl-users-deny = ALL
 acl-users-allow = foo,bar
@@ -107,18 +197,18 @@ acl-users-order = deny-allow
         _expected_profile1 = copy.deepcopy(_expected_defaults)
         _expected_profile1.update({
             u'user': 'foo',
-            u'cmd': 'GNOME',
+            u'command': 'GNOME',
         })
         _expected_profile2 = copy.deepcopy(_expected_defaults)
         _expected_profile2.update({
             u'user': 'bar',
-            u'cmd': 'KDE',
+            u'command': 'KDE',
             u'fullscreen': True,
         })
         _expected_profile3 = copy.deepcopy(_expected_defaults)
         _expected_profile3.update({
             u'user': 'bar',
-            u'cmd': 'KDE',
+            u'command': 'KDE',
             u'fullscreen': True,
         })
         _profile1 = inifile_backend.get_profile('testprofile1')
@@ -154,16 +244,16 @@ acl-clients-allow = 10.0.0.0/16,10.1.0.0/16,admin-1.intern,admin-2.intern
 
 [testprofile1]
 user = foo
-cmd = GNOME
+command = GNOME
 
 [testprofile2]
 user = foo
-cmd = GNOME
+command = GNOME
 acl-clients-deny = 10.0.2.0/24,ALL
 
 [testprofile3]
 user = bar
-cmd = KDE
+command = KDE
 fullscreen = true
 acl-users-deny = ALL
 acl-users-allow = foo,bar
@@ -223,15 +313,15 @@ applications = TERMINAL, WWWBROWSER
 
 [testprofile1]
 user =
-cmd = GNOME
+command = GNOME
 
 [testprofile2]
 user =
-cmd = XFCE
+command = XFCE
 
 [testprofile3]
 user =
-cmd = KDE
+command = KDE
 fullscreen = true
 """
         tf = tempfile.NamedTemporaryFile()
@@ -273,21 +363,21 @@ acl-groups-order = deny-allow
 
 [testprofile1]
 user =
-cmd = GNOME
+command = GNOME
 acl-users-allow = flip
 acl-users-deny = ALL
 acl-users-order = deny-allow
 
 [testprofile2]
 user =
-cmd = XFCE
+command = XFCE
 acl-users-allow = thekla
 acl-users-deny = ALL
 acl-users-order = deny-allow
 
 [testprofile3]
 user =
-cmd = KDE
+command = KDE
 fullscreen = true
 acl-users-deny = willi
 acl-users-order = deny-allow
@@ -302,40 +392,40 @@ acl-users-order = deny-allow
         list_of_profile_ids = list_of_profiles.keys()
         list_of_profile_ids.sort()
         self.assertEqual(list_of_profile_ids, ['testprofile1'])
-        self.assertEqual(list_of_profiles['testprofile1']['cmd'], 'GNOME')
+        self.assertEqual(list_of_profiles['testprofile1']['command'], 'GNOME')
 
         username_m = 'maja'
         list_of_profiles = inifile_backend.list_profiles(username_m)
         list_of_profile_ids = list_of_profiles.keys()
         list_of_profile_ids.sort()
         self.assertEqual(list_of_profile_ids, ['testprofile1', 'testprofile2', 'testprofile3'])
-        self.assertEqual(list_of_profiles['testprofile1']['cmd'], 'GNOME')
-        self.assertEqual(list_of_profiles['testprofile2']['cmd'], 'XFCE')
-        self.assertEqual(list_of_profiles['testprofile3']['cmd'], 'KDE')
+        self.assertEqual(list_of_profiles['testprofile1']['command'], 'GNOME')
+        self.assertEqual(list_of_profiles['testprofile2']['command'], 'XFCE')
+        self.assertEqual(list_of_profiles['testprofile3']['command'], 'KDE')
 
         username_k = 'kassandra'
         list_of_profiles = inifile_backend.list_profiles(username_k)
         list_of_profile_ids = list_of_profiles.keys()
         list_of_profile_ids.sort()
         self.assertEqual(list_of_profile_ids, ['testprofile1', 'testprofile2', 'testprofile3'])
-        self.assertEqual(list_of_profiles['testprofile1']['cmd'], 'GNOME')
-        self.assertEqual(list_of_profiles['testprofile2']['cmd'], 'XFCE')
-        self.assertEqual(list_of_profiles['testprofile3']['cmd'], 'KDE')
+        self.assertEqual(list_of_profiles['testprofile1']['command'], 'GNOME')
+        self.assertEqual(list_of_profiles['testprofile2']['command'], 'XFCE')
+        self.assertEqual(list_of_profiles['testprofile3']['command'], 'KDE')
 
         username_t = 'thekla'
         list_of_profiles = inifile_backend.list_profiles(username_t)
         list_of_profile_ids = list_of_profiles.keys()
         list_of_profile_ids.sort()
         self.assertEqual(list_of_profile_ids, ['testprofile2'])
-        self.assertEqual(list_of_profiles['testprofile2']['cmd'], 'XFCE')
+        self.assertEqual(list_of_profiles['testprofile2']['command'], 'XFCE')
 
         username_w = 'willi'
         list_of_profiles = inifile_backend.list_profiles(username_w)
         list_of_profile_ids = list_of_profiles.keys()
         list_of_profile_ids.sort()
         self.assertEqual(list_of_profile_ids, ['testprofile1', 'testprofile2'])
-        self.assertEqual(list_of_profiles['testprofile1']['cmd'], 'GNOME')
-        self.assertEqual(list_of_profiles['testprofile2']['cmd'], 'XFCE')
+        self.assertEqual(list_of_profiles['testprofile1']['command'], 'GNOME')
+        self.assertEqual(list_of_profiles['testprofile2']['command'], 'XFCE')
 
     ### TEST: select_session() method
 
diff --git a/x2gobroker/tests/test_broker_zeroconf.py b/x2gobroker/tests/test_broker_zeroconf.py
index 0e97b66..1a42278 100644
--- a/x2gobroker/tests/test_broker_zeroconf.py
+++ b/x2gobroker/tests/test_broker_zeroconf.py
@@ -63,6 +63,8 @@ class TestX2GoBrokerBackendZeroconf(unittest.TestCase):
                 'sshport': 22,
                 'setdpi': 0,
                 'pack': u'16m-jpeg',
+                # make sure, hard-coded defaults end up in the list_profiles() output of the zeroconf backend, as well
+                'directrdp': False,
             },
         }
         zeroconf_backend = x2gobroker.brokers.zeroconf_broker.X2GoBroker()
@@ -73,6 +75,8 @@ class TestX2GoBrokerBackendZeroconf(unittest.TestCase):
         _test_profiles = {
             _key: list_of_profiles['unittest']
         }
+        for key in _profiles[_key]:
+            print key, _profiles[_key][key], _test_profiles[_key][key]
         self.assertEqual(_profiles, _test_profiles)
 
     ### TEST: select_profile() method


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

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 "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list