Author: jpotts
Date: Fri Feb 22 04:25:49 2013
New Revision: 1448889
URL: http://svn.apache.org/r1448889
Log:
Making the versionable type in cmislib tests configurable
Modified:
chemistry/cmislib/trunk/src/tests/cmislibtest.py
chemistry/cmislib/trunk/src/tests/settings.py
Modified: chemistry/cmislib/trunk/src/tests/cmislibtest.py
URL:
http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/tests/cmislibtest.py?rev=1448889&r1=1448888&r2=1448889&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/tests/cmislibtest.py (original)
+++ chemistry/cmislib/trunk/src/tests/cmislibtest.py Fri Feb 22 04:25:49 2013
@@ -289,7 +289,8 @@ class RepositoryTest(CmisTestBase):
def testReturnVersion(self):
'''Get latest and latestmajor versions of an object'''
f = open(settings.TEST_BINARY_1, 'rb')
- doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f, properties=props)
doc10Id = doc10.getObjectId()
if (not doc10.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
@@ -788,7 +789,8 @@ class DocumentTest(CmisTestBase):
def testCheckout(self):
'''Create a document in a test folder, then check it out'''
- newDoc = self._testFolder.createDocument('testDocument')
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ newDoc = self._testFolder.createDocument('testDocument',
properties=props)
if (not newDoc.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
return
@@ -806,7 +808,8 @@ class DocumentTest(CmisTestBase):
'''Create a document in a test folder, check it out, then in'''
testFilename = settings.TEST_BINARY_1
contentFile = open(testFilename, 'rb')
- testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile, properties=props)
contentFile.close()
self.assertEquals(testFilename, testDoc.getName())
if (not testDoc.allowableActions['canCheckOut']):
@@ -828,7 +831,8 @@ class DocumentTest(CmisTestBase):
'''Checkin a document with a comment'''
testFilename = settings.TEST_BINARY_1
contentFile = open(testFilename, 'rb')
- testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile, properties=props)
contentFile.close()
self.assertEquals(testFilename, testDoc.getName())
if (not testDoc.allowableActions['canCheckOut']):
@@ -854,7 +858,8 @@ class DocumentTest(CmisTestBase):
testFilename = settings.TEST_BINARY_1
contentFile = open(testFilename, 'rb')
- testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ testDoc = self._testFolder.createDocument(testFilename,
contentFile=contentFile, properties=props)
contentFile.close()
self.assertEquals(testFilename, testDoc.getName())
# Alfresco has a bug where if you get the PWC this way
@@ -877,7 +882,8 @@ class DocumentTest(CmisTestBase):
def testCancelCheckout(self):
'''Create a document in a test folder, check it out, then cancel
checkout'''
- newDoc = self._testFolder.createDocument('testDocument')
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ newDoc = self._testFolder.createDocument('testDocument',
properties=props)
if (not newDoc.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
return
@@ -906,7 +912,8 @@ class DocumentTest(CmisTestBase):
def testGetLatestVersion(self):
'''Get latest version of an object'''
f = open(settings.TEST_BINARY_1, 'rb')
- doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f, properties=props)
if (not doc10.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
return
@@ -934,7 +941,8 @@ class DocumentTest(CmisTestBase):
def testGetPropertiesOfLatestVersion(self):
'''Get properties of latest version of an object'''
f = open(settings.TEST_BINARY_1, 'rb')
- doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ doc10 = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=f, properties=props)
if (not doc10.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
return
@@ -1049,7 +1057,8 @@ class DocumentTest(CmisTestBase):
# create a test document
contentFile = open(testFile1, 'rb')
- newDoc = self._testFolder.createDocument(testFile1,
contentFile=contentFile)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ newDoc = self._testFolder.createDocument(testFile1,
contentFile=contentFile, properties=props)
origMimeType = newDoc.properties['cmis:contentStreamMimeType']
contentFile.close()
@@ -1129,7 +1138,8 @@ class DocumentTest(CmisTestBase):
# create a test document
contentFile = open(settings.TEST_BINARY_1, 'rb')
- newDoc = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=contentFile)
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ newDoc = self._testFolder.createDocument(settings.TEST_BINARY_1,
contentFile=contentFile, properties=props)
contentFile.close()
if (not newDoc.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
@@ -1200,7 +1210,8 @@ class DocumentTest(CmisTestBase):
def testGetAllVersions(self):
'''Get all versions of an object'''
- testDoc = self._testFolder.createDocument('testdoc')
+ props = {'cmis:objectTypeId': settings.VERSIONABLE_TYPE_ID}
+ testDoc = self._testFolder.createDocument('testdoc', properties=props)
if (not testDoc.allowableActions['canCheckOut']):
print 'The test doc cannot be checked out...skipping'
return
Modified: chemistry/cmislib/trunk/src/tests/settings.py
URL:
http://svn.apache.org/viewvc/chemistry/cmislib/trunk/src/tests/settings.py?rev=1448889&r1=1448888&r2=1448889&view=diff
==============================================================================
--- chemistry/cmislib/trunk/src/tests/settings.py (original)
+++ chemistry/cmislib/trunk/src/tests/settings.py Fri Feb 22 04:25:49 2013
@@ -54,3 +54,7 @@ TEST_PRINCIPAL_ID = 'tuser1'
MAX_FULL_TEXT_TRIES = 10
# The number of seconds the test should sleep between tries.
FULL_TEXT_WAIT = 10
+# Specify the type ID of a versionable type. If all types are versionable,
+# specify cmis:document
+VERSIONABLE_TYPE_ID = 'cmis:document'
+#VERSIONABLE_TYPE_ID = 'VersionableType'