X2Go dev team | 25 Jan 10:55 2013

x2gobroker.git - master (branch) updated: 59474fd511d885471a186e0bebaab1b926505b9d

The branch, master has been updated
       via  59474fd511d885471a186e0bebaab1b926505b9d (commit)
      from  f7c7559f78ec6d50ce8bd614a4409b2e9f8c34d1 (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 -----------------------------------------------------------------
commit 59474fd511d885471a186e0bebaab1b926505b9d
Author: Mike Gabriel <mike.gabriel@...>
Date:   Fri Jan 25 10:56:15 2013 +0100

    test list_profiles for inifile backend, make sure that the list profile_ids matches the dictionary keys
of the list_profiles return falue

-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/brokers/base_broker.py       |    2 +-
 x2gobroker/tests/test_broker_inifile.py |   35 +++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

The diff of changes is:
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 42f49f3..4ab60c8 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
 <at>  <at>  -579,7 +579,7  <at>  <at>  class X2GoBroker(object):
             acls = self.get_profile_acls(profile_id)

             if self.check_profile_acls(username, acls):
-                list_of_profiles.update(profile)
+                list_of_profiles.update({profile_id: profile, })

         return list_of_profiles

diff --git a/x2gobroker/tests/test_broker_inifile.py b/x2gobroker/tests/test_broker_inifile.py
index 282a7d1..7b9ff5d 100644
--- a/x2gobroker/tests/test_broker_inifile.py
+++ b/x2gobroker/tests/test_broker_inifile.py
 <at>  <at>  -202,6 +202,41  <at>  <at>  acl-users-order = deny-allow
         for key in _acls_profile3.keys():
             self.assertTrue( ( key in _expected_acls_profile3.keys() ) and ( _acls_profile3[key] ==
_expected_acls_profile3[key] ) )

+    ### TEST: list_profiles() method
+
+    def test_listprofiles(self):
+        username = 'foo'
+        _session_profiles = """
+[DEFAULT]
+exports =
+fullscreen = false
+width = 800
+height = 600
+applications = TERMINAL, WWWBROWSER
+
+[testprofile1]
+user =
+cmd = GNOME
+
+[testprofile2]
+user =
+cmd = XFCE
+
+[testprofile3]
+user =
+cmd = KDE
+fullscreen = true
+"""
+        tf = tempfile.NamedTemporaryFile()
+        print >> tf, _session_profiles
+        tf.seek(0)
+        inifile_backend = inifile.X2GoBroker(profile_config_file=tf.name)
+        profile_ids = inifile_backend.get_profile_ids()
+        profile_ids.sort()
+        list_of_profile_keys = inifile_backend.list_profiles(username).keys()
+        list_of_profile_keys.sort()
+        self.assertEqual(profile_ids, list_of_profile_keys)
+
     ### TEST: select_profile() method

 #    def test_profileselection(self):

hooks/post-receive

Gmane