summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-08 22:59:21 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-08 22:59:21 (GMT)
commit5830a4c0402da9acdcf20b62b359d762dd8c235b (patch)
tree840a001b1bcb293871753ba6a511ce3c40be96f9
parent4bc029340eb0576eb40b8766be67b31e139bf385 (diff)
downloadnetsurf-5830a4c0402da9acdcf20b62b359d762dd8c235b.tar.gz
netsurf-5830a4c0402da9acdcf20b62b359d762dd8c235b.tar.bz2
extend url database checks to cover authentication detail setter and getter
-rw-r--r--test/urldbtest.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 2b2cf64..0b4853c 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <check.h>
#include <libwapcaplet/libwapcaplet.h>
@@ -34,6 +35,7 @@
#include "utils/log.h"
#include "utils/corestrings.h"
#include "utils/nsurl.h"
+#include "utils/nsoption.h"
#include "netsurf/url_db.h"
#include "content/urldb.h"
#include "desktop/cookie_manager.h"
@@ -428,7 +430,7 @@ static TCase *urldb_session_case_create(void)
return tc;
}
-bool urldb_iterate_entries_cb(nsurl *url, const struct url_data *data)
+static bool urldb_iterate_entries_cb(nsurl *url, const struct url_data *data)
{
LOG("url: %s", nsurl_access(url));
@@ -441,9 +443,10 @@ START_TEST(urldb_iterate_entries_test)
}
END_TEST
-bool urldb_iterate_cookies_cb(const struct cookie_data *data)
+static bool urldb_iterate_cookies_cb(const struct cookie_data *data)
{
LOG("%p", data);
+ return true;
}
START_TEST(urldb_iterate_cookies_test)
@@ -452,6 +455,23 @@ START_TEST(urldb_iterate_cookies_test)
}
END_TEST
+START_TEST(urldb_auth_details_test)
+{
+ nsurl *url;
+ const char *res;
+ const char *auth = "mooooo";
+
+ url = make_url("http://www.wikipedia.org/");
+ urldb_set_auth_details(url, "tree", auth);
+
+ res = urldb_get_auth_details(url, "tree");
+ ck_assert_str_eq(res, auth);
+
+ nsurl_unref(url);
+
+}
+END_TEST
+
static TCase *urldb_case_create(void)
{
TCase *tc;
@@ -464,6 +484,7 @@ static TCase *urldb_case_create(void)
tcase_add_test(tc, urldb_iterate_entries_test);
tcase_add_test(tc, urldb_iterate_cookies_test);
+ tcase_add_test(tc, urldb_auth_details_test);
return tc;
}