]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
tests: Add a simple test that creates a HTTP client
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 14:46:54 +0000 (14:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 14:46:54 +0000 (14:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
.gitignore
Makefile.am
tests/libpakfire/httpclient.c [new file with mode: 0644]

index 3922618e6d11f1d9e687423d14fc0b745c2b1a20..fca65496ad07a076d4fe5af57aa32d7594b92b3e 100644 (file)
@@ -26,6 +26,7 @@
 /tests/libpakfire/downloader
 /tests/libpakfire/execute
 /tests/libpakfire/file
+/tests/libpakfire/httpclient
 /tests/libpakfire/jail
 /tests/libpakfire/key
 /tests/libpakfire/main
index 4188697ec2f7eb92bce726d5d7c62e0631a01cb8..660ec4b107c6a04af41f2c529f880bd3cf4a8d24 100644 (file)
@@ -601,6 +601,7 @@ check_PROGRAMS += \
        tests/libpakfire/digest \
        tests/libpakfire/downloader \
        tests/libpakfire/file \
+       tests/libpakfire/httpclient \
        tests/libpakfire/jail \
        tests/libpakfire/key \
        tests/libpakfire/makefile \
@@ -758,6 +759,18 @@ tests_libpakfire_file_CFLAGS = \
 tests_libpakfire_file_LDADD = \
        $(TESTSUITE_LDADD)
 
+dist_tests_libpakfire_httpclient_SOURCES = \
+       tests/libpakfire/httpclient.c
+
+tests_libpakfire_httpclient_CPPFLAGS = \
+       $(TESTSUITE_CPPFLAGS)
+
+tests_libpakfire_httpclient_CFLAGS = \
+       $(TESTSUITE_CFLAGS)
+
+tests_libpakfire_httpclient_LDADD = \
+       $(TESTSUITE_LDADD)
+
 dist_tests_libpakfire_jail_SOURCES = \
        tests/libpakfire/jail.c
 
diff --git a/tests/libpakfire/httpclient.c b/tests/libpakfire/httpclient.c
new file mode 100644 (file)
index 0000000..01e3ca8
--- /dev/null
@@ -0,0 +1,48 @@
+/*#############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2021 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+#############################################################################*/
+
+#include <errno.h>
+
+#include <pakfire/httpclient.h>
+
+#include "../testsuite.h"
+
+static int test_create(const struct test* t) {
+       struct pakfire_httpclient* client = NULL;
+       int r = EXIT_FAILURE;
+
+       // Create a HTTP client
+       ASSERT_SUCCESS(pakfire_httpclient_create(&client, t->ctx));
+
+       // Everything passed
+       r = EXIT_SUCCESS;
+
+FAIL:
+       if (client)
+               pakfire_httpclient_unref(client);
+
+       return r;
+}
+
+int main(int argc, const char* argv[]) {
+       testsuite_add_test(test_create, 0);
+
+       return testsuite_run(argc, argv);
+}