def main(): client = Client(URL, LOGIN, PASSWD) children = client.getRoot().getChildren() print children for doc in children: print "Deleting:", doc.path doc.delete()
def main(): client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) children = client.getRoot().getChildren() print children for doc in children: print "Deleting:", doc.path doc.delete()
def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.folder1 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder1) self.folder2 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder2) self.file = "file%s" % random.randint(0, 1000000000) self.session.create("/" + self.folder1, "File", self.file)
def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.root = self.client.getRoot() testFolderName = "testfolder-%s" % time.time() self.testFolder = self.root.create(testFolderName, "Folder")
def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.folder1 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder1) self.folder2 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder2) self.file = "file%s" % random.randint(0, 1000000000) self.session.create("/" + self.folder1, "File", self.file)
class MultipleFoldersTestCase(unittest.TestCase): def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.folder1 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder1) self.folder2 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder2) self.file = "file%s" % random.randint(0, 1000000000) self.session.create("/" + self.folder1, "File", self.file) def tearDown(self): try: self.session.delete("/" + self.folder1) except: pass try: self.session.delete("/" + self.folder2) except: pass def testMove(self): self.session.move("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc['title']) # Original has disappeared from source folder result = self.session.getChildren("/" + self.folder1) docs = [doc for doc in result['entries'] if doc['title'] == self.file] self.assertEquals(0, len(docs)) def testCopy(self): self.session.copy("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc['title']) # Original is still in the source folder doc = self.session.fetch("/" + self.folder1 + "/" + self.file) self.assertEquals(self.file, doc['title'])
class SingleFileTestCase(unittest.TestCase): def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) self.session.create("/", "File", self.doc_name) def tearDown(self): try: self.session.delete("/" + self.doc_name) except: pass def testGetBlob(self): blob = self.session.getBlob("/" + self.doc_name) self.assertEquals('', blob) def testAttachBlob(self): self.session.attachBlob("/" + self.doc_name, "new blob") blob = self.session.getBlob("/" + self.doc_name) self.assertEquals('new blob', blob) def testSetProperty(self): self.session.setProperty("/" + self.doc_name, 'dc:title', 'new title') doc = self.session.fetch("/" + self.doc_name) self.assertEquals('new title', doc['title']) def testUpdate(self): self.session.update("/" + self.doc_name, {'dc:title': 'new title'}) doc = self.session.fetch("/" + self.doc_name) self.assertEquals('new title', doc['title']) def testSimpleQuery(self): query = "SELECT * FROM File" result = self.session.query(query) docs = [ doc for doc in result['entries'] if doc['title'] == self.doc_name ] self.assertEquals(1, len(docs)) def testLock(self): self.session.lock("/" + self.doc_name) self.session.unlock("/" + self.doc_name)
class MultipleFoldersTestCase(unittest.TestCase): def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.folder1 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder1) self.folder2 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder2) self.file = "file%s" % random.randint(0, 1000000000) self.session.create("/" + self.folder1, "File", self.file) def tearDown(self): try: self.session.delete("/" + self.folder1) except: pass try: self.session.delete("/" + self.folder2) except: pass def testMove(self): self.session.move("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc['title']) # Original has disappeared from source folder result = self.session.getChildren("/" + self.folder1) docs = [ doc for doc in result['entries'] if doc['title'] == self.file ] self.assertEquals(0, len(docs)) def testCopy(self): self.session.copy("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc['title']) # Original is still in the source folder doc = self.session.fetch("/" + self.folder1 + "/" + self.file) self.assertEquals(self.file, doc['title'])
class MultipleFoldersTestCase(unittest.TestCase): def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.folder1 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder1) self.folder2 = "folder%s" % random.randint(0, 1000000000) self.session.create("/", "Folder", self.folder2) self.file = "file%s" % random.randint(0, 1000000000) self.session.create("/" + self.folder1, "File", self.file) def tearDown(self): try: self.session.delete("/" + self.folder1) except: pass try: self.session.delete("/" + self.folder2) except: pass def testMove(self): self.session.move("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc["title"]) # Original has disappeared from source folder result = self.session.getChildren("/" + self.folder1) docs = [doc for doc in result["entries"] if doc["title"] == self.file] self.assertEquals(0, len(docs)) def testCopy(self): self.session.copy("/" + self.folder1 + "/" + self.file, "/" + self.folder2) doc = self.session.fetch("/" + self.folder2 + "/" + self.file) self.assertEquals(self.file, doc["title"]) # Original is still in the source folder doc = self.session.fetch("/" + self.folder1 + "/" + self.file) self.assertEquals(self.file, doc["title"])
class SingleFileTestCase(unittest.TestCase): def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) self.session.create("/", "File", self.doc_name) def tearDown(self): try: self.session.delete("/" + self.doc_name) except: pass def testGetBlob(self): blob = self.session.getBlob("/" + self.doc_name) self.assertEquals("", blob) def testAttachBlob(self): self.session.attachBlob("/" + self.doc_name, "new blob") blob = self.session.getBlob("/" + self.doc_name) self.assertEquals("new blob", blob) def testSetProperty(self): self.session.setProperty("/" + self.doc_name, "dc:title", "new title") doc = self.session.fetch("/" + self.doc_name) self.assertEquals("new title", doc["title"]) def testUpdate(self): self.session.update("/" + self.doc_name, {"dc:title": "new title"}) doc = self.session.fetch("/" + self.doc_name) self.assertEquals("new title", doc["title"]) def testSimpleQuery(self): query = "SELECT * FROM File" result = self.session.query(query) docs = [doc for doc in result["entries"] if doc["title"] == self.doc_name] self.assertEquals(1, len(docs)) def testLock(self): self.session.lock("/" + self.doc_name) self.session.unlock("/" + self.doc_name)
class SimpleTestCase(unittest.TestCase): def setUp(self): #self.client = Client(URL, LOGIN, PASSWD) self.client = Client(HOST) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) def testCreateFile(self): self._testCreate("File") def testCreateFolder(self): self._testCreate("Folder") def testCreateWorkspace(self): self._testCreate("Workspace") def _testCreate(self, type): self.session.create("/", type, self.doc_name) doc = self.session.fetch("/" + self.doc_name) self.assertEquals(type, doc['type']) self.assertEquals(self.doc_name, doc['title']) self.assertEquals("/" + self.doc_name, doc['path']) result = self.session.getChildren("/") docs = [ doc for doc in result['entries'] if doc['title'] == self.doc_name ] self.assertEquals(1, len(docs)) doc = self.session.getParent("/" + self.doc_name) self.assertEquals("/", doc['path']) self.session.delete("/" + self.doc_name) def testUsingUuid(self): doc = self.session.create("/", "File", self.doc_name) uuid = doc['uid'] doc = self.session.fetch(uuid) self.session.delete("/" + self.doc_name)
class SimpleTestCase(unittest.TestCase): def setUp(self): #self.client = Client(URL, LOGIN, PASSWD) self.client = Client(HOST) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) def testCreateFile(self): self._testCreate("File") def testCreateFolder(self): self._testCreate("Folder") def testCreateWorkspace(self): self._testCreate("Workspace") def _testCreate(self, type): self.session.create("/", type, self.doc_name) doc = self.session.fetch("/" + self.doc_name) self.assertEquals(type, doc['type']) self.assertEquals(self.doc_name, doc['title']) self.assertEquals("/"+self.doc_name, doc['path']) result = self.session.getChildren("/") docs = [ doc for doc in result['entries'] if doc['title'] == self.doc_name ] self.assertEquals(1, len(docs)) doc = self.session.getParent("/" + self.doc_name) self.assertEquals("/", doc['path']) self.session.delete("/" + self.doc_name) def testUsingUuid(self): doc = self.session.create("/", "File", self.doc_name) uuid = doc['uid'] doc = self.session.fetch(uuid) self.session.delete("/" + self.doc_name)
class SimpleTestCase(unittest.TestCase): def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.username = '******' def testCreateUser(self): userinfo = self.session.read_user(self.username) if not userinfo: self.session.create_user(self.username, "John", "Doe", "*****@*****.**", 'secret') userinfo = self.session.read_user(self.username)['properties'] self.assertEquals(userinfo['username'], 'test_user') self.assertEquals(userinfo['firstName'], 'John') self.assertEquals(userinfo['lastName'], 'Doe') self.assertEquals(userinfo['email'], '*****@*****.**') def tearDown(self): self.session.delete_user(self.username)
class SimpleTestCase(unittest.TestCase): def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) def testCreateFile(self): self._testCreate("File") def testCreateFolder(self): self._testCreate("Folder") def testCreateWorkspace(self): self._testCreate("Workspace") def _testCreate(self, doc_type): self.session.create("/", doc_type, self.doc_name) doc = self.session.fetch("/" + self.doc_name) self.assertEquals(doc_type, doc["type"]) self.assertEquals(self.doc_name, doc["title"]) self.assertEquals("/" + self.doc_name, doc["path"]) result = self.session.getChildren("/") docs = [doc for doc in result["entries"] if doc["title"] == self.doc_name] self.assertEquals(1, len(docs)) doc = self.session.getParent("/" + self.doc_name) self.assertEquals("/", doc["path"]) self.session.delete("/" + self.doc_name) def testUsingUuid(self): doc = self.session.create("/", "File", self.doc_name) uuid = doc["uid"] doc = self.session.fetch(uuid) self.session.delete("/" + self.doc_name)
def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000)
#!/usr/bin/env python import random import unittest import sys from config import * from nuxeolib import Client if __name__ == '__main__': user = sys.argv[1] host = "localhost:8081" client = Client(host) session = client.getSession() userinfo = session.read_user(user) if not userinfo: session.create_user(user, "a", user, "%[email protected]" % user, user) userinfo = session.read_user(user) print userinfo
class ClientTest(unittest.TestCase): def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.root = self.client.getRoot() testFolderName = "testfolder-%s" % time.time() self.testFolder = self.root.create(testFolderName, "Folder") def tearDown(self): self.testFolder.delete() def testCreateFolder(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") self.assertEqual(name, folder.name) self.assertEqual(name, folder['name']) self.assertEqual(0, len(folder.getChildren())) self.assertEquals(1, len(self.testFolder.getChildren())) def testCreateNote(self): name = 'toto-%s' % time.time() document = self.testFolder.create(name, "Note") self.assertEqual(name, document.name) self.assertEqual(name, document['name']) self.assertEquals(1, len(self.testFolder.getChildren())) blob = document.getBlob() self.assertEquals(None, blob) document.setBlob("toto") blob = document.getBlob() self.assertEquals("toto", blob) def testCreateFile(self): self.assertEquals(0, len(self.testFolder.getChildren())) name = 'toto-%s' % time.time() document = self.testFolder.create(name, "File") self.assertEqual(name, document.name) self.assertEquals(1, len(self.testFolder.getChildren())) blob = document.getBlob() self.assertEquals("", blob) document.setBlob("toto") blob = document.getBlob() self.assertEquals("toto", blob) def testDelete(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") folder.delete() def testDeleteTree(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") name = 'toto-%s' % time.time() folder.create(name, "Folder") folder.delete() def testEditProperty(self): self.testFolder['dc:title'] = "Some new title" self.testFolder.save() self.assertEqual("Some new title", self.testFolder['dc:title']) self.assertEqual("Some new title", self.testFolder.title)
def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.username = '******'
class ClientTest(unittest.TestCase): def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.root = self.client.getRoot() testFolderName = "testfolder-%s" % time.time() self.testFolder = self.root.create(testFolderName, "Folder") def tearDown(self): self.testFolder.delete() def testCreateFolder(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") self.assertEqual(name, folder.name) self.assertEqual(name, folder['name']) self.assertEqual(0, len(folder.getChildren())) self.assertEquals(1, len(self.testFolder.getChildren())) def testCreateNote(self): name = 'toto-%s' % time.time() document = self.testFolder.create(name, "Note") self.assertEqual(name, document.name) self.assertEqual(name, document['name']) self.assertEquals(1, len(self.testFolder.getChildren())) blob = document.getBlob() self.assertEquals(None, blob) document.setBlob("toto") blob = document.getBlob() self.assertEquals("toto", blob) def testCreateFile(self): self.assertEquals(0, len(self.testFolder.getChildren())) name = 'toto-%s' % time.time() document = self.testFolder.create(name, "File") self.assertEqual(name, document.name) self.assertEquals(1, len(self.testFolder.getChildren())) blob = document.getBlob() self.assertEquals("", blob) document.setBlob("toto") blob = document.getBlob() self.assertEquals("toto", blob) def testDelete(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") folder.delete() def testDeleteTree(self): name = 'toto-%s' % time.time() folder = self.testFolder.create(name, "Folder") name = 'toto-%s' % time.time() folder1 = folder.create(name, "Folder") folder.delete() def testEditProperty(self): self.testFolder['dc:title'] = "Some new title" self.testFolder.save() self.assertEqual("Some new title", self.testFolder['dc:title']) self.assertEqual("Some new title", self.testFolder.title)
def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.root = self.client.getRoot() testFolderName = "testfolder-%s" % time.time() self.testFolder = self.root.create(testFolderName, "Folder")
def setUp(self): #self.client = Client(URL, LOGIN, PASSWD) self.client = Client(HOST) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000)
def setUp(self): self.client = Client(SCHEME, HOST, port=PORT, context=CONTEXT, netrc_file=NETRC_FILE) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000)
def setUp(self): self.client = Client(URL, LOGIN, PASSWD) self.session = self.client.getSession() self.doc_name = "doc%s" % random.randint(0, 1000000000) self.session.create("/", "File", self.doc_name)
#!/usr/bin/env python import random import unittest import sys from config import * from nuxeolib import Client if __name__ == '__main__': user = sys.argv[1] host = "localhost:8081" client = Client(host) session = client.getSession() userinfo = session.read_user (user) if not userinfo: session.create_user (user, "a", user, "%[email protected]" % user, user) userinfo = session.read_user (user) print userinfo