Commit 33dd37ef authored by Lucas Carvalho's avatar Lucas Carvalho

Updated the tests with latest changes.

parent 03fed990
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
############################################################################## ##############################################################################
import httplib
import json import json
import transaction import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -60,11 +61,13 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): ...@@ -60,11 +61,13 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
data_file.seek(0) data_file.seek(0)
self.portal.changeSkin('SHADIR') self.portal.changeSkin('SHADIR')
self.shadir.REQUEST.set('method', 'POST') path = self.shadir.getPath()
self.shadir.REQUEST.set('Content-Type', 'application/json') response = self.publish('%s/%s' % (path, key),
self.shadir.REQUEST._file = data_file request_method='PUT',
self.shadir.WebSection_getDocumentValue(key) stdin=data_file,
basic='ERP5TypeTestCase:')
self.stepTic() self.stepTic()
self.assertEqual(response.getStatus(), httplib.CREATED)
finally: finally:
data_file.close() data_file.close()
...@@ -88,6 +91,7 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): ...@@ -88,6 +91,7 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
'document_module',): 'document_module',):
folder = self.portal[module] folder = self.portal[module]
folder.manage_delObjects(list(folder.objectIds())) folder.manage_delObjects(list(folder.objectIds()))
self.portal.portal_caches.clearAllCache()
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -108,8 +112,10 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): ...@@ -108,8 +112,10 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
self.assertEquals(self.sha512sum, document.getReference()) self.assertEquals(self.sha512sum, document.getReference())
self.assertEquals(self.data, document.getData()) self.assertEquals(self.data, document.getData())
self.assertEquals(data_set, document.getFollowUpValue()) self.assertEquals(data_set, document.getFollowUpValue())
self.assertEquals(self.expiration_date, document.getExpirationDate()) self.assertEquals(str(self.expiration_date),
str(document.getExpirationDate()))
self.assertEquals('application/json', document.getContentType()) self.assertEquals('application/json', document.getContentType())
self.assertEquals('Published', document.getValidationStateTitle())
def test_get_information(self): def test_get_information(self):
""" """
...@@ -132,9 +138,12 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase): ...@@ -132,9 +138,12 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
""" """
self.assertEquals(0, len(self.portal.data_set_module)) self.assertEquals(0, len(self.portal.data_set_module))
self.assertEquals(0, len(self.portal.document_module)) self.assertEquals(0, len(self.portal.document_module))
self.postInformation()
for x in xrange(10): for x in xrange(10):
self.postInformation() self.postInformation()
self.assertEquals(1, len(self.portal.data_set_module)) self.assertEquals(1, len(self.portal.data_set_module))
data_set = self.portal.data_set_module.contentValues()[0] data_set = self.portal.data_set_module.contentValues()[0]
self.assertEquals(self.key, data_set.getReference()) self.assertEquals(self.key, data_set.getReference())
......
43 44
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment