executet 'ruff format --check .'
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / lint-shell (push) Has been cancelled
Mark stable commit / lint-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / lint-shell (push) Has been cancelled
Mark stable commit / lint-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
This commit is contained in:
@@ -10,6 +10,7 @@ class FakeRunResult:
|
||||
"""
|
||||
Mimics your runner returning a structured result object.
|
||||
"""
|
||||
|
||||
returncode: int
|
||||
stdout: str
|
||||
stderr: str = ""
|
||||
@@ -19,6 +20,7 @@ class FakeRunner:
|
||||
"""
|
||||
Minimal runner stub: returns exactly what we configure.
|
||||
"""
|
||||
|
||||
def __init__(self, result):
|
||||
self._result = result
|
||||
|
||||
@@ -37,26 +39,34 @@ class TestE2ENixProfileListJsonParsing(unittest.TestCase):
|
||||
def test_list_json_accepts_raw_string(self) -> None:
|
||||
from pkgmgr.actions.install.installers.nix.profile import NixProfileInspector
|
||||
|
||||
payload = {"elements": {"pkgmgr-1": {"attrPath": "packages.x86_64-linux.pkgmgr"}}}
|
||||
payload = {
|
||||
"elements": {"pkgmgr-1": {"attrPath": "packages.x86_64-linux.pkgmgr"}}
|
||||
}
|
||||
raw = json.dumps(payload)
|
||||
|
||||
runner = FakeRunner(raw)
|
||||
inspector = NixProfileInspector()
|
||||
|
||||
data = inspector.list_json(ctx=None, runner=runner)
|
||||
self.assertEqual(data["elements"]["pkgmgr-1"]["attrPath"], "packages.x86_64-linux.pkgmgr")
|
||||
self.assertEqual(
|
||||
data["elements"]["pkgmgr-1"]["attrPath"], "packages.x86_64-linux.pkgmgr"
|
||||
)
|
||||
|
||||
def test_list_json_accepts_runresult_object(self) -> None:
|
||||
from pkgmgr.actions.install.installers.nix.profile import NixProfileInspector
|
||||
|
||||
payload = {"elements": {"pkgmgr-1": {"attrPath": "packages.x86_64-linux.pkgmgr"}}}
|
||||
payload = {
|
||||
"elements": {"pkgmgr-1": {"attrPath": "packages.x86_64-linux.pkgmgr"}}
|
||||
}
|
||||
raw = json.dumps(payload)
|
||||
|
||||
runner = FakeRunner(FakeRunResult(returncode=0, stdout=raw))
|
||||
inspector = NixProfileInspector()
|
||||
|
||||
data = inspector.list_json(ctx=None, runner=runner)
|
||||
self.assertEqual(data["elements"]["pkgmgr-1"]["attrPath"], "packages.x86_64-linux.pkgmgr")
|
||||
self.assertEqual(
|
||||
data["elements"]["pkgmgr-1"]["attrPath"], "packages.x86_64-linux.pkgmgr"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user