[X2Go-Commits] x2gobroker.git - statusflag (branch) updated: 0.0.1.0-10-g8130c9d

X2Go dev team git-admin at x2go.org
Tue Jun 4 21:09:59 CEST 2013


The branch, statusflag has been updated
       via  8130c9d12e3447fda3064b4b3f1ba0aef1015341 (commit)
      from  00fb61c3429809f7511f7bda5667a77facd96918 (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 |    4 +-
 x2gobroker/brokers/zeroconf_broker.py      |    7 +-
 x2gobroker/defaults.py                     |    4 +-
 x2gobroker/tests/test_broker_base.py       |    4 +-
 x2gobroker/tests/test_broker_inifile.py    |   99 ++++++++++++++++++++--------
 x2gobroker/tests/test_broker_zeroconf.py   |    4 ++
 7 files changed, 90 insertions(+), 35 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 9c77984..be2985b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
 x2gobroker (0.0.1.1-0~x2go1) UNRELEASED; urgency=low
 
   * New upstream version (0.0.1.1):
-    - 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«.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sun, 10 Mar 2013 13:00:32 +0100
 
diff --git a/etc/broker/x2gobroker-sessionprofiles.conf b/etc/broker/x2gobroker-sessionprofiles.conf
index 0d79e7c..8d060ec 100644
--- a/etc/broker/x2gobroker-sessionprofiles.conf
+++ b/etc/broker/x2gobroker-sessionprofiles.conf
@@ -29,7 +29,7 @@
 
 
 [DEFAULT]
-cmd=TERMINAL
+command=TERMINAL
 defsndport=true
 useiconv=false
 iconvfrom=UTF-8
@@ -53,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 0cc2058..9e61d83 100644
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -161,7 +161,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',
@@ -185,7 +185,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 fbef0ca..1371724 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 f2c32a3..6bc62f8 100644
--- a/x2gobroker/tests/test_broker_inifile.py
+++ b/x2gobroker/tests/test_broker_inifile.py
@@ -60,7 +60,7 @@ applications = TERMINAL, WWWBROWSER
 
 [testprofile]
 user = foo
-cmd = GNOME
+command = GNOME
 
 """
         tf = tempfile.NamedTemporaryFile()
@@ -78,7 +78,7 @@ cmd = GNOME
             u'height': 600,
             u'applications': ['TERMINAL','WWWBROWSER',],
             u'user': 'foo',
-            u'cmd': 'GNOME',
+            u'command': 'GNOME',
         } )
         # just testing the directrdp hard-coded defaults
         _expected_defaults.update( {
@@ -92,6 +92,51 @@ cmd = GNOME
         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):
@@ -119,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
@@ -152,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')
@@ -199,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
@@ -268,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()
@@ -318,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
@@ -347,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