Commit 2e678ec3 authored by Georgios Dagkakis's avatar Georgios Dagkakis

testERP5Web: fix expected values in test_12_getWebSiteValue

Also, url that is published in
test_14_AccessWebSiteForWithDifferentUserPreferences
iotherwise the response is the redirect, making the test fail
parent 5dfbb27a
...@@ -994,28 +994,28 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -994,28 +994,28 @@ Hé Hé Hé!""", page.asText().strip())
request = self.portal.REQUEST request = self.portal.REQUEST
request['HTTP_REFERER'] = '' request['HTTP_REFERER'] = ''
website_absolute_url = website.absolute_url() website_absolute_url = website.absolute_url()
self.assertEqual(website_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(website_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(websection_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(websection_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(webpage_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(webpage_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(website_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(website_fr.Base_doLanguage('en'), website_absolute_url)
self.assertEqual(websection_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(websection_fr.Base_doLanguage('en'), website_absolute_url)
self.assertEqual(webpage_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(webpage_fr.Base_doLanguage('en'), website_absolute_url)
self.assertEqual(website_bg_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(website_bg_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(websection_bg_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(websection_bg_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(webpage_bg_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(webpage_bg_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
self.assertEqual(website_bg_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(website_bg_fr.Base_doLanguage('en'), website_absolute_url)
self.assertEqual(websection_bg_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(websection_bg_fr.Base_doLanguage('en'), website_absolute_url)
self.assertEqual(webpage_bg_fr.Base_doLanguage('en'), website_absolute_url) self.assertEqual(webpage_bg_fr.Base_doLanguage('en'), website_absolute_url)
# change language with referer # change language with referer
request['HTTP_REFERER'] = website_fr.absolute_url() request['HTTP_REFERER'] = website_fr.absolute_url()
self.assertEqual(website_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(website_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
request['HTTP_REFERER'] = websection_fr.absolute_url() request['HTTP_REFERER'] = websection_fr.absolute_url()
self.assertEqual(websection_fr.Base_doLanguage('de'), websection_fr.absolute_url().replace('/fr/', '/de/')) self.assertEqual(websection_fr.Base_doLanguage('de'), websection_fr.absolute_url().replace('/fr/', '/de/'))
request['HTTP_REFERER'] = webpage_fr.absolute_url() request['HTTP_REFERER'] = webpage_fr.absolute_url()
self.assertEqual(webpage_fr.Base_doLanguage('de'), webpage_fr.absolute_url().replace('/fr/', '/de/')) self.assertEqual(webpage_fr.Base_doLanguage('de'), webpage_fr.absolute_url().replace('/fr/', '/de/'))
request['HTTP_REFERER'] = website_bg_fr.absolute_url() request['HTTP_REFERER'] = website_bg_fr.absolute_url()
self.assertEqual(website_bg_fr.Base_doLanguage('de'), '%s/de' % website_absolute_url) self.assertEqual(website_bg_fr.Base_doLanguage('de'), '%sde/' % website_absolute_url)
request['HTTP_REFERER'] = websection_bg_fr.absolute_url() request['HTTP_REFERER'] = websection_bg_fr.absolute_url()
self.assertEqual(websection_bg_fr.Base_doLanguage('de'), websection_bg_fr.absolute_url().replace('/bg/fr/', '/de/')) self.assertEqual(websection_bg_fr.Base_doLanguage('de'), websection_bg_fr.absolute_url().replace('/bg/fr/', '/de/'))
request['HTTP_REFERER'] = webpage_bg_fr.absolute_url() request['HTTP_REFERER'] = webpage_bg_fr.absolute_url()
...@@ -1033,9 +1033,9 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1033,9 +1033,9 @@ Hé Hé Hé!""", page.asText().strip())
self.assertEqual(self.publish(websection_bg_en_fr.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(websection_bg_en_fr.absolute_url(relative=1)).getHeader('location'),
websection_fr.absolute_url()) websection_fr.absolute_url())
self.assertEqual(self.publish(webpage_bg_en_fr.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(webpage_bg_en_fr.absolute_url(relative=1)).getHeader('location'),
webpage_fr.absolute_url()) webpage_fr.absolute_url() + '/')
self.assertEqual(self.publish(website_bg_en_fr.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'), self.assertEqual(self.publish(website_bg_en_fr.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'),
website_fr.absolute_url()+'?a=b&c=d') website_fr.absolute_url() +'?a=b&c=d')
# /bg/en/xxx should be redirected to /xxx where en is the default language # /bg/en/xxx should be redirected to /xxx where en is the default language
website_bg_en = self.portal.restrictedTraverse( website_bg_en = self.portal.restrictedTraverse(
...@@ -1049,7 +1049,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1049,7 +1049,7 @@ Hé Hé Hé!""", page.asText().strip())
self.assertEqual(self.publish(websection_bg_en.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(websection_bg_en.absolute_url(relative=1)).getHeader('location'),
websection.absolute_url()) websection.absolute_url())
self.assertEqual(self.publish(webpage_bg_en.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(webpage_bg_en.absolute_url(relative=1)).getHeader('location'),
webpage.absolute_url()) webpage.absolute_url() + '/')
self.assertEqual(self.publish(websection_bg_en.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'), self.assertEqual(self.publish(websection_bg_en.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'),
websection.absolute_url()+'?a=b&c=d') websection.absolute_url()+'?a=b&c=d')
...@@ -1065,9 +1065,9 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1065,9 +1065,9 @@ Hé Hé Hé!""", page.asText().strip())
self.assertEqual(self.publish(websection_en.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(websection_en.absolute_url(relative=1)).getHeader('location'),
websection.absolute_url()) websection.absolute_url())
self.assertEqual(self.publish(webpage_en.absolute_url(relative=1)).getHeader('location'), self.assertEqual(self.publish(webpage_en.absolute_url(relative=1)).getHeader('location'),
webpage.absolute_url()) webpage.absolute_url() + '/')
self.assertEqual(self.publish(webpage_en.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'), self.assertEqual(self.publish(webpage_en.absolute_url(relative=1)+'?a=b&c=d').getHeader('location'),
webpage.absolute_url()+'?a=b&c=d') webpage.absolute_url()+'/?a=b&c=d')
def test_13_DocumentCache(self): def test_13_DocumentCache(self):
""" """
...@@ -1286,7 +1286,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -1286,7 +1286,7 @@ Hé Hé Hé!""", page.asText().strip())
web_site = self.setupWebSite() web_site = self.setupWebSite()
websection = self.setupWebSection() websection = self.setupWebSection()
websection_url = '%s/%s' % (self.portal.getId(), websection.getRelativeUrl()) websection_url = '%s/%s' % (self.portal.getId(), websection.absolute_url(relative=1))
# connect as administrator and check that only developper_mode is enable # connect as administrator and check that only developper_mode is enable
response = self.publish(websection_url, 'administrator:administrator') response = self.publish(websection_url, 'administrator:administrator')
......
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