]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
tests: build: Try to create with invalid IDs
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Aug 2022 15:45:59 +0000 (15:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Aug 2022 15:45:59 +0000 (15:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/libpakfire/build.c

index a1a44500520fc1fb4b094b0f9b1cb595a0300a3d..94a4b1e3e99a558becae3cd57a3bfc1a7cbf4339 100644 (file)
@@ -42,8 +42,24 @@ FAIL:
        return EXIT_FAILURE;
 }
 
+static int test_create_with_invalid_ids(const struct test* t) {
+       struct pakfire_build* build = NULL;
+
+       // Try to create a build with an invalid UUID
+       ASSERT_ERRNO(pakfire_build_create(&build, t->pakfire, "ABC", 0), EINVAL);
+
+       // Try to create a build with an empty UUID
+       ASSERT_ERRNO(pakfire_build_create(&build, t->pakfire, "", 0), EINVAL);
+
+       return EXIT_SUCCESS;
+
+FAIL:
+       return EXIT_FAILURE;
+}
+
 int main(int argc, char** argv) {
        testsuite_add_test(test_create_and_free);
+       testsuite_add_test(test_create_with_invalid_ids);
 
        return testsuite_run();
 }