def FAIL_testUpload(self): r = RestAPI(self) r.login(*self.cred_admin) uid = '44f1af7e-5206-4f39-b935-55bb32ab3112' r.uploadFile(uid, 'foo.txt') r.logout()
def FAIL_testUpload(self): r = RestAPI(self) r.login(*self.cred_admin) uid = "44f1af7e-5206-4f39-b935-55bb32ab3112" r.uploadFile(uid, "foo.txt") r.logout()
def testReader(self): # browse the workspace r = RestAPI(self) r.login(*self.cred_admin) uid = r.getRootWorkspaceUid() uid = r.getChildUid(uid, self.ws_title, "Workspace") self.assert_(uid, 'Workspace "%s" not found.' % self.ws_title) uid = r.getChildUid(uid, self.dir_title, "Folder") self.assert_(uid, 'Folder "%s" not found.' % self.dir_title) count = 0 nb_read = self.nb_read for item in r.browse(uid): ret = r.exportTree(item.id) zc = ZipFile(StringIO(ret)) self.assert_(".nuxeo-archive" in zc.namelist()) count += 1 if count > nb_read: break r.logout()
def initWorkspace(self): """Create an initial workspace using rest, because DAV is not allowed to create workspace.""" r = RestAPI(self) r.login(*self.cred_admin) root_uid = r.getRootWorkspaceUid() ws_uid = r.getChildUid(root_uid, self.ws_title, 'Workspace') if not ws_uid: ws_uid = r.createDocument(root_uid, 'Workspace', self.ws_title, 'DAV Test workspace description.')
def testBrowse(self): # browse the workspace r = RestAPI(self) r.login(*self.cred_admin) uid = r.getRootWorkspaceUid() folders = [] documents = [] class Root: id = uid type = 'Folder' title = "Root worksapce" f = open(self.folder_file, 'w+') d = open(self.doc_file, 'w+') browse(r, Root(), f, d) f.close() d.close() r.logout() print "Done" print "Output on %s and %s" % (self.folder_file, self.doc_file)
def testWriter(self): # Create a folder and few documents r = RestAPI(self) r.login(*self.cred_admin) root_uid = r.getRootWorkspaceUid() ws_uid = r.getChildUid(root_uid, self.ws_title, "Workspace") if not ws_uid: ws_uid = r.createDocument(root_uid, "Workspace", self.ws_title, "Test workspace description.") dir_uid = r.getChildUid(ws_uid, self.dir_title, "Folder") if not dir_uid: dir_uid = r.createDocument(ws_uid, "Folder", self.dir_title, "Test folder description") for i in range(self.nb_doc): title = self._lipsum.getSubject(uniq=True, prefix=self.tag) description = self.tag + " " + self._lipsum.getParagraph(1) uid = r.createDocument(dir_uid, "File", title, description) r.logout()
def testReader(self): # browse the workspace r = RestAPI(self) r.login(*self.cred_admin) uid = r.getRootWorkspaceUid() uid = r.getChildUid(uid, self.ws_title, 'Workspace') self.assert_(uid, 'Workspace "%s" not found.' % self.ws_title) uid = r.getChildUid(uid, self.dir_title, 'Folder') self.assert_(uid, 'Folder "%s" not found.' % self.dir_title) count = 0 nb_read = self.nb_read for item in r.browse(uid): ret = r.exportTree(item.id) zc = ZipFile(StringIO(ret)) self.assert_('.nuxeo-archive' in zc.namelist()) count += 1 if count > nb_read: break r.logout()
def testWriter(self): # Create a folder and few documents r = RestAPI(self) r.login(*self.cred_admin) root_uid = r.getRootWorkspaceUid() ws_uid = r.getChildUid(root_uid, self.ws_title, 'Workspace') if not ws_uid: ws_uid = r.createDocument(root_uid, 'Workspace', self.ws_title, 'Test workspace description.') dir_uid = r.getChildUid(ws_uid, self.dir_title, 'Folder') if not dir_uid: dir_uid = r.createDocument(ws_uid, 'Folder', self.dir_title, 'Test folder description') for i in range(self.nb_doc): title = self._lipsum.getSubject(uniq=True, prefix=self.tag) description = self.tag + ' ' + self._lipsum.getParagraph(1) uid = r.createDocument(dir_uid, 'File', title, description) r.logout()