mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-09 22:43:44 +08:00
fix(plugin): sanitize local repo path telemetry
This commit is contained in:
23
tests/test_plugin_helper.py
Normal file
23
tests/test_plugin_helper.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class PluginHelperTest(TestCase):
|
||||
|
||||
def test_sanitize_repo_url_for_statistic_keeps_remote_url(self):
|
||||
try:
|
||||
from app.helper.plugin import PluginHelper
|
||||
except ModuleNotFoundError as exc:
|
||||
self.skipTest(f"missing dependency: {exc}")
|
||||
repo_url = "https://github.com/InfinityPacer/MoviePilot-Plugins"
|
||||
self.assertEqual(repo_url, PluginHelper.sanitize_repo_url_for_statistic(repo_url))
|
||||
|
||||
def test_sanitize_repo_url_for_statistic_strips_local_path(self):
|
||||
try:
|
||||
from app.helper.plugin import PluginHelper
|
||||
except ModuleNotFoundError as exc:
|
||||
self.skipTest(f"missing dependency: {exc}")
|
||||
repo_url = "local://TestPlugin?path=/Users/InfinityPacer/GitHub/MoviePilot/MoviePilot-Plugins&version=v2"
|
||||
self.assertEqual(
|
||||
"local://TestPlugin?version=v2",
|
||||
PluginHelper.sanitize_repo_url_for_statistic(repo_url)
|
||||
)
|
||||
Reference in New Issue
Block a user