]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix unit tests
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 24 May 2024 18:59:15 +0000 (12:59 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 24 May 2024 18:59:15 +0000 (12:59 -0600)
test/cache/local_cache_test.c
test/rrdp_test.c

index 3cd53ae71ab1e6f4ecc764558f701a42c7d0471b..7d175d065a6455486c481cafe4a8c9596aa71add 100644 (file)
@@ -58,27 +58,27 @@ file_rm_rf(char const *file)
 }
 
 static int
-pretend_download(struct rpki_uri *uri)
+pretend_download(char const *local)
 {
        struct downloaded_path *dl;
 
        if (dl_error)
                return -EINVAL;
-       if (file_exists(uri_get_local(uri)) == 0)
+       if (file_exists(local) == 0)
                return 0;
 
        dl = pmalloc(sizeof(struct downloaded_path));
-       dl->path = pstrdup(uri_get_local(uri));
+       dl->path = pstrdup(local);
        dl->visited = false;
        SLIST_INSERT_HEAD(&downloaded, dl, hook);
        return 0;
 }
 
 int
-rsync_download(struct rpki_uri *uri)
+rsync_download(char const *src, char const *dst, bool is_directory)
 {
        rsync_counter++;
-       return pretend_download(uri);
+       return pretend_download(dst);
 }
 
 int
@@ -86,7 +86,7 @@ http_download(struct rpki_uri *uri, bool *changed)
 {
        int error;
        https_counter++;
-       error = pretend_download(uri);
+       error = pretend_download(uri_get_local(uri));
        if (changed != NULL)
                *changed = error ? false : true;
        return error;
index 18ef83681acf07474d59129fa326b53730a351d4..71317400ae8241a0fa02042b785bcfa2b8a3e345 100644 (file)
@@ -17,7 +17,8 @@ MOCK_ABORT_INT(cache_download, struct rpki_cache *cache, struct rpki_uri *uri,
     bool *changed)
 MOCK_ABORT_VOID(file_close, FILE *file)
 MOCK_ABORT_INT(file_rm_rf, char const *path)
-MOCK_ABORT_INT(file_write, char const *file_name, FILE **result)
+MOCK_ABORT_INT(file_write, char const *file_name, char const *mode,
+              FILE **result)
 MOCK_ABORT_INT(delete_dir_recursive_bottom_up, char const *path)
 MOCK_ABORT_INT(mkdir_p, char const *path, bool include_basename)
 MOCK_ABORT_VOID(fnstack_pop, void)