mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 03:37:00 +02:00
Compare commits
No commits in common. "525de56036319f91c44c0e680a44cc0294208248" and "daa4aa00598046056c1e2b685b1526a76f5a8abd" have entirely different histories.
525de56036
...
daa4aa0059
@ -4,9 +4,8 @@ from typing import Literal
|
|||||||
|
|
||||||
api_filter = r"(.*&key=)([^&]*)(.*)"
|
api_filter = r"(.*&key=)([^&]*)(.*)"
|
||||||
home_filter = r"(/home/)([^\s'\/]*)(.*)"
|
home_filter = r"(/home/)([^\s'\/]*)(.*)"
|
||||||
user_filter = r"(.*Steam/userdata/)([^/]*)(.*)"
|
|
||||||
REDACTED = r"\1REDACTED\3"
|
REDACTED = r"\1REDACTED\3"
|
||||||
REDACTION_PATTERNS = [api_filter, home_filter, user_filter]
|
REDACTION_PATTERNS = [api_filter, home_filter]
|
||||||
|
|
||||||
|
|
||||||
def redact_home(text: str) -> str:
|
def redact_home(text: str) -> str:
|
||||||
|
|||||||
@ -114,5 +114,4 @@ markers = [
|
|||||||
"post_install: requires a completed installation",
|
"post_install: requires a completed installation",
|
||||||
"redact: log redaction mechanisms",
|
"redact: log redaction mechanisms",
|
||||||
"slow: long-running tests",
|
"slow: long-running tests",
|
||||||
"webtest: depends on remote endpoint",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@ -37,14 +37,6 @@ class RecordsListHandler(logging.Handler):
|
|||||||
"Error in directory: '/home/SENSITIVE_USERNAME'",
|
"Error in directory: '/home/SENSITIVE_USERNAME'",
|
||||||
"Error in directory: '/home/REDACTED'",
|
"Error in directory: '/home/REDACTED'",
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"User directory: /home/user/.local/share/Steam/userdata/999999/grid",
|
|
||||||
"User directory: /home/REDACTED/.local/share/Steam/userdata/REDACTED/grid",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"User directory: /drive/.local/share/Steam/userdata/999999",
|
|
||||||
"User directory: /drive/.local/share/Steam/userdata/REDACTED",
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_log_redaction(log_error: str, expect: str) -> None:
|
def test_log_redaction(log_error: str, expect: str) -> None:
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from dzgui.config.query import get_config
|
|||||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||||
from dzgui.api import probe
|
from dzgui.api import probe
|
||||||
|
|
||||||
pytestmark = pytest.mark.webtest
|
pytestmark = pytest.mark.apitest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
@ -38,14 +38,14 @@ def dummy_app() -> None:
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
def test_wrap_exe(dummy_app: dict[str, str]) -> None:
|
def test_wrap_exe(dummy_app) -> None:
|
||||||
s = Shortcuts(Path(""))
|
s = Shortcuts(Path(""))
|
||||||
s.add_shortcut(*dummy_app.values())
|
s.add_shortcut(*dummy_app.values())
|
||||||
assert s.shortcuts["shortcuts"]["0"]["Exe"][0] == '"'
|
assert s.shortcuts["shortcuts"]["0"]["Exe"][0] == '"'
|
||||||
assert s.shortcuts["shortcuts"]["0"]["Exe"][-1] == '"'
|
assert s.shortcuts["shortcuts"]["0"]["Exe"][-1] == '"'
|
||||||
|
|
||||||
|
|
||||||
def test_add_shortcut(dummy_app: dict[str, str]) -> None:
|
def test_add_shortcut(dummy_app) -> None:
|
||||||
s = Shortcuts(Path(""))
|
s = Shortcuts(Path(""))
|
||||||
s.add_shortcut(*dummy_app.values())
|
s.add_shortcut(*dummy_app.values())
|
||||||
new = s.shortcuts["shortcuts"]
|
new = s.shortcuts["shortcuts"]
|
||||||
@ -56,7 +56,7 @@ def test_add_shortcut(dummy_app: dict[str, str]) -> None:
|
|||||||
assert new[ind][k] == v
|
assert new[ind][k] == v
|
||||||
|
|
||||||
|
|
||||||
def test_save_shortcut(dummy_app: dict[str, str]) -> None:
|
def test_save_shortcut(dummy_app) -> None:
|
||||||
s = Shortcuts(Path(""))
|
s = Shortcuts(Path(""))
|
||||||
s.add_shortcut(*dummy_app.values())
|
s.add_shortcut(*dummy_app.values())
|
||||||
with tempfile.NamedTemporaryFile() as f:
|
with tempfile.NamedTemporaryFile() as f:
|
||||||
@ -65,27 +65,3 @@ def test_save_shortcut(dummy_app: dict[str, str]) -> None:
|
|||||||
s.save_shortcuts()
|
s.save_shortcuts()
|
||||||
s._load_shortcuts(tmp)
|
s._load_shortcuts(tmp)
|
||||||
assert len(s.shortcuts["shortcuts"]) == 1
|
assert len(s.shortcuts["shortcuts"]) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_shortcut_crc(dummy_app: dict[str, str]) -> None:
|
|
||||||
s = Shortcuts(Path(""))
|
|
||||||
s.add_shortcut(*dummy_app.values())
|
|
||||||
for key in s.shortcuts["shortcuts"].keys():
|
|
||||||
entry = s.shortcuts["shortcuts"][key]
|
|
||||||
name = entry["AppName"]
|
|
||||||
exe = entry["Exe"]
|
|
||||||
uid = name + exe
|
|
||||||
bpid = s.gen_bpid(uid)
|
|
||||||
assert entry["appid"] & 0xFFFFFFFF == bpid
|
|
||||||
|
|
||||||
|
|
||||||
def test_reverse_crc(dummy_app: dict[str, str]) -> None:
|
|
||||||
s = Shortcuts(Path(""))
|
|
||||||
s.add_shortcut(*dummy_app.values())
|
|
||||||
for key in s.shortcuts["shortcuts"].keys():
|
|
||||||
entry = s.shortcuts["shortcuts"][key]
|
|
||||||
name = entry["AppName"]
|
|
||||||
exe = entry["Exe"]
|
|
||||||
uid = name + exe
|
|
||||||
bpid = s.gen_bpid(uid)
|
|
||||||
assert s.find_appname_by_unsigned_id(bpid) == name
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user