summaryrefslogtreecommitdiff
path: root/test/urldbtest.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-09 00:09:33 +0100
committerVincent Sanders <vince@kyllikki.org>2016-08-09 00:09:33 +0100
commit54860ee6b8fe1ad33977eca490200929ea9cfac5 (patch)
tree5d022700b69f4d091473af00b160329f66991168 /test/urldbtest.c
parent5830a4c0402da9acdcf20b62b359d762dd8c235b (diff)
downloadnetsurf-54860ee6b8fe1ad33977eca490200929ea9cfac5.tar.gz
netsurf-54860ee6b8fe1ad33977eca490200929ea9cfac5.tar.bz2
add cookie database load and restore unit test
Diffstat (limited to 'test/urldbtest.c')
-rw-r--r--test/urldbtest.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/urldbtest.c b/test/urldbtest.c
index 0b4853cc4..faf6d6ee5 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -37,10 +37,12 @@
#include "utils/nsurl.h"
#include "utils/nsoption.h"
#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
#include "content/urldb.h"
#include "desktop/cookie_manager.h"
const char *test_urldb_path = "test/data/urldb";
+const char *test_cookies_path = "test/data/cookies";
struct netsurf_table *guit = NULL;
@@ -139,6 +141,7 @@ static void urldb_create_loaded(void)
res = urldb_load(test_urldb_path);
ck_assert_int_eq(res, NSERROR_OK);
+ urldb_load_cookies(test_cookies_path);
}
static void urldb_lwc_iterator(lwc_string *str, void *pw)
@@ -401,17 +404,23 @@ START_TEST(urldb_session_test)
res = urldb_load(test_urldb_path);
ck_assert_int_eq(res, NSERROR_OK);
+ urldb_load_cookies(test_cookies_path);
+
/* write database out */
outnam = tmpnam(NULL);
res = urldb_save(outnam);
ck_assert_int_eq(res, NSERROR_OK);
+ /* remove test output */
+ unlink(outnam);
+
+ /* write cookies out */
+ urldb_save_cookies(outnam);
+
/* finalise options */
res = nsoption_finalise(NULL, NULL);
ck_assert_int_eq(res, NSERROR_OK);
- /* remove test output */
- unlink(outnam);
}
END_TEST
@@ -460,7 +469,7 @@ 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);