1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Fix stubs and move some tests to http_common

This commit is contained in:
William Wennerström 2020-07-21 13:11:50 +02:00
parent be62b446f7
commit 1bb6cecee6
No known key found for this signature in database
GPG Key ID: E1382990BEDD319B
10 changed files with 23 additions and 48 deletions

View File

@ -126,7 +126,6 @@ unittest_sources = \
tests/unittests/log/stub_log.c \
tests/unittests/database/stub_database.c \
tests/unittests/config/stub_accounts.c \
tests/unittests/tools/stub_http_common.c \
tests/unittests/tools/stub_http_upload.c \
tests/unittests/tools/stub_http_download.c \
tests/unittests/tools/stub_aesgcm_download.c \
@ -156,7 +155,7 @@ unittest_sources = \
tests/unittests/test_cmd_disconnect.c tests/unittests/test_cmd_disconnect.h \
tests/unittests/test_callbacks.c tests/unittests/test_callbacks.h \
tests/unittests/test_plugins_disco.c tests/unittests/test_plugins_disco.h \
tests/unittests/test_http_download.c tests/unittests/test_http_download.h \
tests/unittests/test_http_common.c tests/unittests/test_http_common.h \
tests/unittests/unittests.c
functionaltest_sources = \

View File

@ -64,35 +64,31 @@ http_basename_from_url(const char* url)
}
void
http_print_transfer_update(ProfWin* window, char* url,
const char* fmt, ...)
http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
char* msg;
if (vasprintf(&msg, fmt, args) == -1) {
msg = strdup(FALLBACK_MSG);
}
GString* msg = g_string_new(FALLBACK_MSG);
g_string_vprintf(msg, fmt, args);
va_end(args);
win_update_entry_message(window, url, msg);
free(msg);
win_update_entry_message(window, url, msg->str);
g_string_free(msg, TRUE);
}
void
http_print_transfer(ProfWin* window, char* url,
const char* fmt, ...)
http_print_transfer(ProfWin* window, char* url, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
char* msg;
if (vasprintf(&msg, fmt, args) == -1) {
msg = strdup(FALLBACK_MSG);
}
GString* msg = g_string_new(FALLBACK_MSG);
g_string_vprintf(msg, fmt, args);
va_end(args);
win_print_http_transfer(window, msg, url);
free(msg);
win_print_http_transfer(window, msg->str, url);
g_string_free(msg, TRUE);
}

View File

@ -36,8 +36,6 @@
#ifndef TOOLS_HTTP_COMMON_H
#define TOOLS_HTTP_COMMON_H
#define _GNU_SOURCE 1
#include "ui/window.h"
char* http_basename_from_url(const char* url);

View File

@ -8,7 +8,7 @@
#include "config.h"
#include "tools/http_download.h"
#include "tools/http_common.c"
typedef struct
{

View File

@ -15,9 +15,13 @@ typedef struct aesgcm_download_t
HTTPDownload* http_dl;
} AESGCMDownload;
void* aesgcm_file_get(void* userdata);
void*
aesgcm_file_get(void* userdata)
{
return NULL;
};
void aesgcm_download_cancel_processes(ProfWin* window);
void aesgcm_download_add_download(AESGCMDownload* download);
void aesgcm_download_cancel_processes(ProfWin* window){};
void aesgcm_download_add_download(AESGCMDownload* download){};
#endif

View File

@ -1,16 +0,0 @@
#ifndef TOOLS_HTTP_COMMON_H
#define TOOLS_HTTP_COMMON_H
typedef struct prof_win_t ProfWin;
char*
http_basename_from_url(const char* url)
{
return "";
}
void http_print_transfer(ProfWin* window, char* url, const char* fmt, ...);
void http_print_transfer_update(ProfWin* window, char* url,
const char* fmt, ...);
#endif

View File

@ -18,9 +18,4 @@ typedef struct http_download_t
int cancel;
} HTTPDownload;
void* http_file_get(void* userdata);
void http_download_cancel_processes(ProfWin* window);
void http_download_add_download(HTTPDownload* download);
#endif

View File

@ -20,8 +20,6 @@ typedef struct http_upload_t
int cancel;
} HTTPUpload;
//GSList *upload_processes;
void*
http_file_put(void* userdata)
{
@ -33,6 +31,7 @@ file_mime_type(const char* const file_name)
{
return NULL;
}
off_t
file_size(const char* const file_name)
{

View File

@ -38,7 +38,7 @@
#include "test_form.h"
#include "test_callbacks.h"
#include "test_plugins_disco.h"
#include "test_http_download.h"
#include "test_http_common.h"
int
main(int argc, char* argv[])