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)