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
import time
from StringIO import StringIO
import zipfile
import httplib
import urlparse
class LocalStringIO(StringIO):
......@@ -45,6 +47,7 @@ class TestOfficeJSScenario(SecurityTestCase):
return user
def test_01_user_can_contribute(self):
timestamp = "%s" % time.time()
###################################
### Manager: Create user
person = self.createNewUser()
......@@ -52,26 +55,48 @@ class TestOfficeJSScenario(SecurityTestCase):
###################################
### User: submit application
self.logout()
self.login(person.getUserId())
import_file = LocalStringIO('your.zip')
my_zip = zipfile.ZipFile(import_file, 'w')
my_zip.writestr('foo.txt', 'foobar')
my_zip.writestr('index.html', 'My super content')
my_zip.close()
version = 'My Bar version %s' % timestamp
self.portal.ERP5Site_createNewSoftwarePublication(
import_file,
'software/application',
'My Foo App',
'My Bar version'
version
)
self.tic()
###################################
### Alarm: extract zip file
self.logout()
self.login()
self.portal.portal_alarms.officejs_process_submit_software_publication\
.activeSense()
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 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<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>
</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