本文整理汇总了Python中gitfs.views.current.CurrentView.getattr方法的典型用法代码示例。如果您正苦于以下问题:Python CurrentView.getattr方法的具体用法?Python CurrentView.getattr怎么用?Python CurrentView.getattr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitfs.views.current.CurrentView
的用法示例。
在下文中一共展示了CurrentView.getattr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getattr
# 需要导入模块: from gitfs.views.current import CurrentView [as 别名]
# 或者: from gitfs.views.current.CurrentView import getattr [as 别名]
def test_getattr(self):
mocked_full = MagicMock()
mocked_os = MagicMock()
mocked_stat = MagicMock()
mocked_repo = MagicMock()
mocked_stat.simple = "stat"
mocked_os.lstat.return_value = mocked_stat
mocked_full.return_value = "full_path"
mocked_repo._full_path = mocked_full
with patch.multiple('gitfs.views.current', os=mocked_os,
STATS=['simple']):
current = CurrentView(repo=mocked_repo, uid=1, gid=1,
repo_path="repo_path",
ignore=CachedIgnore())
current._full_path = mocked_full
result = current.getattr("path")
asserted_result = {
'st_uid': 1,
'st_gid': 1,
'simple': "stat"
}
assert result == asserted_result
mocked_os.lstat.assert_called_once_with("full_path")
mocked_full.assert_called_once_with("path")