[glom] test_selfhosting_new_empty_then_users: Show the problem with spaces.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_selfhosting_new_empty_then_users: Show the problem with spaces.
- Date: Wed, 1 Feb 2012 14:25:55 +0000 (UTC)
commit b1e34c7fa68334660ee77774ba48a18a4ced6ca1
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 8889a9a..4c2ee00 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 a7d126e..5e1a890 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]