def step(context, receiver, resource, permissions): resource = substituteInLineCodes(context, resource) socketConnect = syncstate.SocketConnect() socketConnect.sendCommand("SHARE:" + resource + "\n") permissionsList = permissions.split(',') test.compare(str(waitForObjectExists(names.scrollArea_sharedWith_QLabel).text), receiver) test.compare(waitForObjectExists(names.scrollArea_permissionsEdit_QCheckBox).checked, ('edit' in permissionsList)) test.compare(waitForObjectExists(names.scrollArea_permissionShare_QCheckBox).checked, ('share' in permissionsList))
def shareResource(resource): socketConnect = syncstate.SocketConnect() socketConnect.sendCommand("SHARE:" + resource + "\n") if not socketConnect.read_socket_data_with_timeout(0.1): return False for line in socketConnect.get_available_responses(): if line.startswith('SHARE:OK') and line.endswith(resource): return True elif line.endswith(resource): return False
def isItemSynced(type, itemName): if type != 'FILE' and type != 'FOLDER': raise Exception("type must be 'FILE' or 'FOLDER'") socketConnect = syncstate.SocketConnect() socketConnect.sendCommand("RETRIEVE_" + type + "_STATUS:" + itemName + "\n"); if not socketConnect.read_socket_data_with_timeout(0.1): return False for line in socketConnect.get_available_responses(): if (line.startswith('STATUS:OK') and line.endswith(itemName)): return True elif line.endswith(itemName): return False