[glom/glom-1-20] test_selfhosting_new_empty_then_users: Show the problem with spaces.



commit 82d18aae64074f718f40a90e15f7f2b10bc003a9
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Feb 1 15:25:43 2012 +0100

    test_selfhosting_new_empty_then_users: Show the problem with spaces.
    
    * tests/test_selfhosting_new_empty_then_users.cc:
    Privs::get_table_privileges() must parse a strange format. This test
    shows that it fails if the group name contains spaces.

 ChangeLog                                      |    8 +++++
 tests/test_selfhosting_new_empty_then_users.cc |   38 +++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d20131f..71d6093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-02-01  Murray Cumming  <murrayc murrayc com>
 
+	test_selfhosting_new_empty_then_users: Show the problem with spaces.
+
+	* tests/test_selfhosting_new_empty_then_users.cc: 
+	Privs::get_table_privileges() must parse a strange format. This test
+	shows that it fails if the group name contains spaces.
+
+2012-02-01  Murray Cumming  <murrayc murrayc com>
+
 	Limit user and group name lengths.
 
 	* glom/libglom/privs.[h|cc]: Add a MAX_ROLE_SIZE enum constants.
diff --git a/tests/test_selfhosting_new_empty_then_users.cc b/tests/test_selfhosting_new_empty_then_users.cc
index a3c8ad4..9bba432 100644
--- a/tests/test_selfhosting_new_empty_then_users.cc
+++ b/tests/test_selfhosting_new_empty_then_users.cc
@@ -162,13 +162,49 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   {
     for(type_vec_strings::const_iterator iter_group = group_names.begin(); iter_group != group_names.end(); ++iter_group)
     {
+      const Glib::ustring group_name = *iter_group;
       const Glib::ustring username = Glib::ustring::compose("%1%2", *iter_user, i); //Make sure the username is unique.
-      if(!test_add_user(document, username, *iter_group))
+      if(!test_add_user(document, username, group_name))
         return false;
+
+      for(type_vec_strings::const_iterator iter_table = table_names.begin(); iter_table != table_names.end(); ++iter_table)
+      {
+        const Glib::ustring table_name = *iter_table;
+        const Glom::Privileges privs = Glom::Privs::get_table_privileges(group_name, table_name);
+        if(!privs.m_view)
+        {
+          std::cerr << "Privs::get_table_privileges() returned an unexpected view privilege for group=" << group_name << ", table_name=" << table_name << std::endl;
+          return false;
+        }
+
+        if(!privs.m_edit)
+        {
+          std::cerr << "Privs::get_table_privileges() returned an unexpected edit privilege for group=" << group_name << ", table_name=" << table_name << std::endl;
+          return false;
+        }
+
+	/*
+        if(!privs.m_create)
+        {
+          std::cerr << "Privs::get_table_privileges() returned an unexpected create privilege for group=" << group_name << ", table_name=" << table_name << std::endl;
+          return false;
+        }
+
+        if(!privs.m_delete)
+        {
+          std::cerr << "Privs::get_table_privileges() returned an unexpected delete privilege for group=" << group_name << ", table_name=" << table_name << std::endl;
+          return false;
+        }
+	*/
+      }
+
       ++i;
     }
   }
 
+  //Test get_table_privileges().
+ 
+
 
   test_selfhosting_cleanup(false /* do not delete the file. */);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]