def test_getattrs_should_get_attrs(endpoint, fl): response = prepare_getattr('path', fuse_messages_pb2.REG) stat = fslogic.Stat() with reply(endpoint, response) as queue: assert 0 == fl.getattr('/random/path', stat) client_message = queue.get() assert client_message.HasField('fuse_request') fuse_request = client_message.fuse_request assert fuse_request.HasField('get_file_attr') get_file_attr = fuse_request.get_file_attr assert get_file_attr.entry_type == fuse_messages_pb2.PATH assert get_file_attr.entry == '/random/path' repl = response.fuse_response.file_attr assert stat.atime == repl.atime assert stat.mtime == repl.mtime assert stat.ctime == repl.ctime assert stat.gid == repl.gid assert stat.uid == repl.uid assert stat.mode == repl.mode | fslogic.regularMode() assert stat.size == repl.size
def test_chmod_should_change_cached_mode(appmock_client, endpoint, fl, uuid): getattr_response = prepare_attr_response(uuid, fuse_messages_pb2.REG) with reply(endpoint, getattr_response): stat = fl.getattr(uuid) assert stat.mode == getattr_response.fuse_response.file_attr.mode | \ fslogic.regularMode() assert 3 == endpoint.all_messages_count() appmock_client.reset_tcp_history() response = messages_pb2.ServerMessage() response.fuse_response.status.code = common_messages_pb2.Status.ok with reply(endpoint, [response, response]): fl.chmod(uuid, 0356) stat = fl.getattr(uuid) assert stat.mode == 0356 | fslogic.regularMode()
def test_getattrs_should_get_attrs(endpoint, fl, uuid): response = prepare_attr_response(uuid, fuse_messages_pb2.REG) with reply(endpoint, response) as queue: stat = fl.getattr(uuid) client_message = queue.get() assert client_message.HasField('fuse_request') fuse_request = client_message.fuse_request assert fuse_request.file_request.HasField('get_file_attr') assert fuse_request.file_request.context_guid == uuid repl = response.fuse_response.file_attr assert repl.uuid == uuid assert stat.atime == repl.atime assert stat.mtime == repl.mtime assert stat.ctime == repl.ctime assert stat.gid == repl.gid assert stat.uid == repl.uid assert stat.mode == repl.mode | fslogic.regularMode() assert stat.size == repl.size
def test_getattrs_should_get_attrs(endpoint, fl): response = prepare_getattr('path', fuse_messages_pb2.REG) stat = fslogic.Stat() with reply(endpoint, response) as queue: assert 0 == fl.getattr('/random/path', stat) client_message = queue.get() assert client_message.HasField('fuse_request') fuse_request = client_message.fuse_request assert fuse_request.HasField('resolve_guid') assert fuse_request.resolve_guid.path == '/random/path' repl = response.fuse_response.file_attr assert stat.atime == repl.atime assert stat.mtime == repl.mtime assert stat.ctime == repl.ctime assert stat.gid == repl.gid assert stat.uid == repl.uid assert stat.mode == repl.mode | fslogic.regularMode() assert stat.size == repl.size