From cc1132a5b4677d089e024bcd0e16e1e817a3581c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 25 Dec 2018 18:56:55 +0100 Subject: warc: Add tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using hyothesis-based testcase generation. This is quite nice compared to manual test data generation, since it catches alot more corner cases (if done right). This commit also fixes a few issues, including: - log records will only be written if the log is nonempty - properly quote packageUrl path’s - drop old thread checking code - use placeholder url for scripts without name --- crocoite/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crocoite/util.py') diff --git a/crocoite/util.py b/crocoite/util.py index 5bced53..ded5e99 100644 --- a/crocoite/util.py +++ b/crocoite/util.py @@ -22,7 +22,7 @@ Random utility functions """ -import random, sys, platform, os, json +import random, sys, platform, os, json, urllib from datetime import datetime import hashlib, pkg_resources @@ -43,7 +43,7 @@ def packageUrl (path): """ Create URL for package data stored into WARC """ - return 'urn:' + __package__ + ':' + path + return 'urn:' + __package__ + ':' + urllib.parse.quote (path) async def getFormattedViewportMetrics (tab): layoutMetrics = await tab.Page.getLayoutMetrics () -- cgit v1.2.3