From 3cb04d781080de9db8393fc741dbee35883c0b58 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 10 Aug 2009 13:47:51 +0000
Subject: [PATCH] add a test to confirm if getWebSiteValue() always includes
 selected Language.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28321 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testERP5Web.py | 42 +++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py
index 81175b6675..8ebb0a9928 100644
--- a/product/ERP5/tests/testERP5Web.py
+++ b/product/ERP5/tests/testERP5Web.py
@@ -814,6 +814,48 @@ class TestERP5Web(ERP5TypeTestCase, ZopeTestCase.Functional):
     self.assertSameSet([sub_web_section], 
                        web_site.getWebSectionValueList(web_page))
 
+  def test_12_getWebSiteValue(self, quiet=quiet, run=run_all_test):
+    """
+      Test that getWebSiteValue() always includes selected Language.
+    """
+    if not run: return
+    if not quiet:
+      message = '\ntest_12_getWebSiteValue'
+      ZopeTestCase._print(message)
+
+    self.setupWebSite()
+    portal = self.getPortal()
+    web_site_module = self.portal.getDefaultModule('Web Site')
+    web_site = web_site_module[self.website_id]
+    web_site_relative_url = web_site.absolute_url(relative=1)
+    web_site_fr = web_site.restrictedTraverse('fr')
+    web_site_relative_url_fr = '%s/fr' % web_site_relative_url
+    page = self.web_page_module.newContent(portal_type='Web Page',
+                                           reference='foo',
+                                           text_content='<b>OK</b>')
+    page.publish()
+    transaction.commit()
+    self.tic()
+
+    web_page = web_site.restrictedTraverse('foo')
+    web_page_fr = web_site_fr.restrictedTraverse('foo')
+
+    web_page_module = web_site.restrictedTraverse('web_page_module')
+    web_page_module_fr = web_site_fr.restrictedTraverse('web_page_module')
+
+    self.assertEquals(web_site_relative_url,
+                      web_site.getWebSiteValue().absolute_url(relative=1))
+    self.assertEquals(web_site_relative_url_fr,
+                      web_site_fr.getWebSiteValue().absolute_url(relative=1))
+    self.assertEquals(web_site_relative_url,
+                      web_page.getWebSiteValue().absolute_url(relative=1))
+    self.assertEquals(web_site_relative_url_fr,
+                      web_page_fr.getWebSiteValue().absolute_url(relative=1))
+    self.assertEquals(web_site_relative_url,
+                      web_page_module.getWebSiteValue().absolute_url(relative=1))
+    self.assertEquals(web_site_relative_url_fr,
+                      web_page_module_fr.getWebSiteValue().absolute_url(relative=1))
+
 class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
   """
   Test for erp5_web with simple security.
-- 
2.30.9