def test_utime_should_pass_utime_errors(endpoint, fl, uuid, stat): response = messages_pb2.ServerMessage() response.fuse_response.status.code = common_messages_pb2.Status.eperm with pytest.raises(RuntimeError) as excinfo: with reply(endpoint, response): fl.utime(uuid) assert 'Operation not permitted' in str(excinfo.value) ubuf = fslogic.Ubuf() with pytest.raises(RuntimeError) as excinfo: with reply(endpoint, response): fl.utime_buf(uuid, ubuf) assert 'Operation not permitted' in str(excinfo.value)
def test_utime_should_pass_utime_errors(endpoint, fl): getattr_response = prepare_getattr('path', fuse_messages_pb2.DIR) response = messages_pb2.ServerMessage() response.fuse_response.status.code = common_messages_pb2.Status.eperm with pytest.raises(RuntimeError) as excinfo: with reply(endpoint, [getattr_response, response]): fl.utime('/random/path') assert 'Operation not permitted' in str(excinfo.value) ubuf = fslogic.Ubuf() with pytest.raises(RuntimeError) as excinfo: with reply(endpoint, response): fl.utime_buf('/random/path', ubuf) assert 'Operation not permitted' in str(excinfo.value)
def test_utime_should_update_times_with_buf(endpoint, fl, uuid, stat): response = messages_pb2.ServerMessage() response.fuse_response.status.code = common_messages_pb2.Status.ok ubuf = fslogic.Ubuf() ubuf.actime = 54321 ubuf.modtime = 12345 with reply(endpoint, response) as queue: fl.utime_buf(uuid, ubuf) client_message = queue.get() assert client_message.HasField('fuse_request') assert client_message.fuse_request.HasField('file_request') file_request = client_message.fuse_request.file_request assert file_request.HasField('update_times') update_times = file_request.update_times assert update_times.atime == ubuf.actime assert update_times.mtime == ubuf.modtime assert file_request.context_guid == uuid
def test_utime_should_update_times_with_buf(endpoint, fl): getattr_response = prepare_getattr('path', fuse_messages_pb2.REG) response = messages_pb2.ServerMessage() response.fuse_response.status.code = common_messages_pb2.Status.ok ubuf = fslogic.Ubuf() ubuf.actime = 54321 ubuf.modtime = 12345 with reply(endpoint, [getattr_response, response]) as queue: assert 0 == fl.utime_buf('/random/path', ubuf) queue.get() client_message = queue.get() assert client_message.HasField('fuse_request') fuse_request = client_message.fuse_request assert fuse_request.HasField('update_times') update_times = fuse_request.update_times assert update_times.uuid == getattr_response.fuse_response.file_attr.uuid assert update_times.atime == ubuf.actime assert update_times.mtime == ubuf.modtime