Commit 386e8f35 authored by Romain Courteaud's avatar Romain Courteaud

[officejs_test] Check web site rendering

parent cae3752e
...@@ -2,6 +2,8 @@ from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase ...@@ -2,6 +2,8 @@ from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
import time import time
from StringIO import StringIO from StringIO import StringIO
import zipfile import zipfile
import httplib
import urlparse
class LocalStringIO(StringIO): class LocalStringIO(StringIO):
...@@ -45,6 +47,7 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -45,6 +47,7 @@ class TestOfficeJSScenario(SecurityTestCase):
return user return user
def test_01_user_can_contribute(self): def test_01_user_can_contribute(self):
timestamp = "%s" % time.time()
################################### ###################################
### Manager: Create user ### Manager: Create user
person = self.createNewUser() person = self.createNewUser()
...@@ -52,26 +55,48 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -52,26 +55,48 @@ class TestOfficeJSScenario(SecurityTestCase):
################################### ###################################
### User: submit application ### User: submit application
self.logout()
self.login(person.getUserId()) self.login(person.getUserId())
import_file = LocalStringIO('your.zip') import_file = LocalStringIO('your.zip')
my_zip = zipfile.ZipFile(import_file, 'w') my_zip = zipfile.ZipFile(import_file, 'w')
my_zip.writestr('foo.txt', 'foobar') my_zip.writestr('index.html', 'My super content')
my_zip.close() my_zip.close()
version = 'My Bar version %s' % timestamp
self.portal.ERP5Site_createNewSoftwarePublication( self.portal.ERP5Site_createNewSoftwarePublication(
import_file, import_file,
'software/application', 'software/application',
'My Foo App', 'My Foo App',
'My Bar version' version
) )
self.tic() self.tic()
################################### ###################################
### Alarm: extract zip file ### Alarm: extract zip file
self.logout()
self.login() self.login()
self.portal.portal_alarms.officejs_process_submit_software_publication\ self.portal.portal_alarms.officejs_process_submit_software_publication\
.activeSense() .activeSense()
self.tic() self.tic()
web_section = self.portal.portal_catalog.getResultValue(
portal_type='Static Web Section',
title=version
)
###################################
### Anonymous: access the new application
self.logout()
api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc)
connection.request(
method='GET',
url='%s/' % web_section.absolute_url()
)
response = connection.getresponse()
self.assertEquals(response.read(), 'My super content')
self.assertEquals(response.status, 200)
...@@ -45,7 +45,12 @@ ...@@ -45,7 +45,12 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple/> <tuple>
<string>W: 91, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W: 91, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W: 91, 4: Unused variable \'api_scheme\' (unused-variable)</string>
<string>W: 92, 6: Unused variable \'api_fragment\' (unused-variable)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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