diff --git a/.gitignore b/.gitignore index cb30975..8990430 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ kleingebaeck releases t/out .bak +t/httproot/out +t/httproot/kleinanzeigen +t/httproot/favicon.ico diff --git a/t/httproot/README.md b/t/httproot/README.md new file mode 100644 index 0000000..64a244a --- /dev/null +++ b/t/httproot/README.md @@ -0,0 +1,13 @@ +# Mock http server + +Install ehfs from https://github.com/mjpclab/extra-http-file-server/. + +Install p2cli from https://github.com/wrouesnel/p2cli. + +Run `templates/render.sh` to build the file structure. + +Run `server.sh` to start the http server. + +To scrape an ad from it, use such a URL: + +http://localhost:8080/s-anzeige/first-ad/111-11-111 diff --git a/t/httproot/img/cdas4sd5-5258-42c2-bf58-as43as5d43as b/t/httproot/img/cdas4sd5-5258-42c2-bf58-as43as5d43as new file mode 100644 index 0000000..0521c28 Binary files /dev/null and b/t/httproot/img/cdas4sd5-5258-42c2-bf58-as43as5d43as differ diff --git a/t/httproot/img/cdas4sd5-5258-42c2-bf58-d1b8e9221574 b/t/httproot/img/cdas4sd5-5258-42c2-bf58-d1b8e9221574 new file mode 100644 index 0000000..75c508d Binary files /dev/null and b/t/httproot/img/cdas4sd5-5258-42c2-bf58-d1b8e9221574 differ diff --git a/t/httproot/img/fcf6d664-5258-42c2-bf58-as43as5d43as b/t/httproot/img/fcf6d664-5258-42c2-bf58-as43as5d43as new file mode 100644 index 0000000..d37ac06 Binary files /dev/null and b/t/httproot/img/fcf6d664-5258-42c2-bf58-as43as5d43as differ diff --git a/t/httproot/img/fcf6d664-5258-42c2-bf58-d1b8e9221574 b/t/httproot/img/fcf6d664-5258-42c2-bf58-d1b8e9221574 new file mode 100644 index 0000000..97e500d Binary files /dev/null and b/t/httproot/img/fcf6d664-5258-42c2-bf58-d1b8e9221574 differ diff --git a/t/httproot/serve.sh b/t/httproot/serve.sh new file mode 100755 index 0000000..9f6a816 --- /dev/null +++ b/t/httproot/serve.sh @@ -0,0 +1,4 @@ +#!/bin/sh +ehfs -a :/s-anzeige:./kleinanzeigen \ + -a :/api/v1/prod-ads/images/fc:./img \ + -l localhost:8080 -I index.html diff --git a/t/httproot/templates/ad.tpl b/t/httproot/templates/ad.tpl new file mode 100644 index 0000000..34635c7 --- /dev/null +++ b/t/httproot/templates/ad.tpl @@ -0,0 +1,50 @@ + + +
++ {{ text }} +
+