From f5bc97e5f00fce5f51328012a01c6a667a82148d Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Tue, 15 Sep 2026 18:27:41 +0300 Subject: [PATCH] fix: OsOperations::get_user is not implemented (restore prev code) Test is added. --- src/os_ops.py | 2 +- tests/test_os_ops_common.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/os_ops.py b/src/os_ops.py index fbaa351..9ef487b 100644 --- a/src/os_ops.py +++ b/src/os_ops.py @@ -167,7 +167,7 @@ def reset_env( RaiseError.MethodIsNotImplemented(__class__, "reset_env") def get_user(self) -> typing.Optional[str]: - RaiseError.MethodIsNotImplemented(__class__, "get_user") + return self.username def get_name(self) -> str: RaiseError.MethodIsNotImplemented(__class__, "get_name") diff --git a/tests/test_os_ops_common.py b/tests/test_os_ops_common.py index 0f806d6..6a32b66 100644 --- a/tests/test_os_ops_common.py +++ b/tests/test_os_ops_common.py @@ -183,6 +183,17 @@ def test_prop__username(self, os_ops_descr: OsOpsDescr): assert v is None or type(v) is str return + def test_prop__get_user(self, os_ops_descr: OsOpsDescr): + assert type(os_ops_descr) is OsOpsDescr + assert isinstance(os_ops_descr.os_ops, OsOperations) + + os_ops = os_ops_descr.os_ops + assert isinstance(os_ops, OsOperations) + + v = os_ops.get_user() + assert v is None or type(v) is str + return + def test_get_platform(self, os_ops_descr: OsOpsDescr): assert type(os_ops_descr) is OsOpsDescr assert isinstance(os_ops_descr.os_ops, OsOperations)