[tracker/wip/carlosg/test: 2/3] libtracker-common: Drop unused function and its test



commit bfc4b8f020e12f6e6c436fc04bd83a505bde8595
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 6 10:55:02 2018 +0100

    libtracker-common: Drop unused function and its test
    
    This function is no longer used, so makes no sense to test for
    it. This test used to break on CI with the default docker images
    because of user permissions, so this obstacle is removed.

 src/libtracker-common/tracker-file-utils.c        | 28 ----------------------
 src/libtracker-common/tracker-file-utils.h        |  1 -
 tests/libtracker-common/tracker-file-utils-test.c | 29 -----------------------
 3 files changed, 58 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index ce9b7e98d..9f5409d20 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -703,34 +703,6 @@ path_has_write_access (const gchar *path,
        return writable;
 }
 
-gboolean
-tracker_path_has_write_access_or_was_created (const gchar *path)
-{
-       gboolean writable;
-       gboolean exists = FALSE;
-
-       writable = path_has_write_access (path, &exists);
-       if (exists) {
-               if (writable) {
-                       g_message ("  Path is OK");
-                       return TRUE;
-               }
-
-               g_message ("  Path can not be written to");
-       } else {
-               g_message ("  Path does not exist, attempting to create...");
-
-               if (g_mkdir_with_parents (path, 0700) == 0) {
-                       g_message ("  Path was created");
-                       return TRUE;
-               }
-
-               g_message ("  Path could not be created");
-       }
-
-       return FALSE;
-}
-
 gboolean
 tracker_file_is_hidden (GFile *file)
 {
diff --git a/src/libtracker-common/tracker-file-utils.h b/src/libtracker-common/tracker-file-utils.h
index 2b6beabde..45c5f9374 100644
--- a/src/libtracker-common/tracker-file-utils.h
+++ b/src/libtracker-common/tracker-file-utils.h
@@ -52,7 +52,6 @@ GSList * tracker_path_list_filter_duplicates                (GSList      *roots,
                                                              const gchar *basename_exception_prefix,
                                                              gboolean     is_recursive);
 gchar *  tracker_path_evaluate_name                         (const gchar *uri);
-gboolean tracker_path_has_write_access_or_was_created       (const gchar *path);
 gboolean tracker_filename_casecmp_without_extension         (const gchar *a,
                                                              const gchar *b);
 
diff --git a/tests/libtracker-common/tracker-file-utils-test.c 
b/tests/libtracker-common/tracker-file-utils-test.c
index d1ddf3004..93a409b37 100644
--- a/tests/libtracker-common/tracker-file-utils-test.c
+++ b/tests/libtracker-common/tracker-file-utils-test.c
@@ -367,33 +367,6 @@ test_file_system_has_enough_space ()
         //g_assert (!tracker_file_system_has_enough_space ("/home", G_MAXULONG, FALSE));
 }
 
-static void
-test_file_exists_and_writable ()
-{
-        const gchar *path = "./test-dir-remove-afterwards";
-
-        if (g_file_test (path, G_FILE_TEST_EXISTS)) {
-               g_assert_cmpint (g_remove (path), ==, 0);
-        }
-
-        /* This should create the directory with write access*/
-        g_assert (tracker_path_has_write_access_or_was_created (path));
-        g_assert (g_file_test (path, G_FILE_TEST_EXISTS));
-
-        /* This time exists and has write access */
-        g_assert (tracker_path_has_write_access_or_was_created (path));
-
-        g_assert_cmpint (chmod (path, S_IRUSR & S_IRGRP), ==, 0);
-
-        /* Exists but is not writable */
-        g_assert (!tracker_path_has_write_access_or_was_created (path));
-
-        /* Doesn't exist and cannot be created */
-        g_assert (!tracker_path_has_write_access_or_was_created ("/var/log/tracker-test"));
-
-        g_assert_cmpint (g_remove (path), ==, 0);
-}
-
 static void
 test_file_utils_is_hidden ()
 {
@@ -460,8 +433,6 @@ main (int argc, char **argv)
                          test_file_system_get_remaining_space_percentage);
         g_test_add_func ("/libtracker-common/file-utils/has_enough_space",
                          test_file_system_has_enough_space);
-        g_test_add_func ("/libtracker-common/file-utils/has_write_access_or_was_created",
-                         test_file_exists_and_writable);
         g_test_add_func ("/libtracker-common/file-utils/is_hidden",
                          test_file_utils_is_hidden);
         g_test_add_func ("/libtracker-common/file-utils/cmp",


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