Add tests to urlrewrite_piratebay.py

Fixes an issue with the plugin and adds some tests.