Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
PloneLanguageTool.tests.test_negotiation.TestCombinedLanguageNegotiation Class Reference
Inheritance diagram for PloneLanguageTool.tests.test_negotiation.TestCombinedLanguageNegotiation:
Inheritance graph
[legend]
Collaboration diagram for PloneLanguageTool.tests.test_negotiation.TestCombinedLanguageNegotiation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testLanguageNegotiation

Public Attributes

 basic_auth
 portal_path
 tool

Detailed Description

Definition at line 67 of file test_negotiation.py.


Member Function Documentation

Reimplemented from PloneLanguageTool.tests.test_negotiation.LanguageNegotiationTestCase.

Definition at line 69 of file test_negotiation.py.

00069 
00070     def afterSetUp(self):
00071         LanguageNegotiationTestCase.afterSetUp(self)
00072         # set some allowed languages and make sure we don't use combined
00073         # language codes
00074         self.tool.supported_langs = ['en', 'pt', 'de', 'pt-br']
00075         self.tool.use_combined_language_codes = 1
00076         self.tool.display_flags = 0

Definition at line 77 of file test_negotiation.py.

00077 
00078     def testLanguageNegotiation(self):
00079         # Test simple supported codes
00080         response = self.publish(self.portal_path, self.basic_auth,
00081                                 env={'HTTP_ACCEPT_LANGUAGE': 'pt'})
00082 
00083         self.assertEquals(response.getStatus(), 200)
00084         self.failUnless('<option selected="selected" value="pt">'
00085             in response.getBody())
00086 
00087         response = self.publish(self.portal_path, self.basic_auth,
00088                                 env={'HTTP_ACCEPT_LANGUAGE': 'de'})
00089 
00090         self.assertEquals(response.getStatus(), 200)
00091         self.failUnless('<option selected="selected" value="de">'
00092             in response.getBody())
00093 
00094         # Test combined supported codes
00095         response = self.publish(self.portal_path, self.basic_auth,
00096                                 env={'HTTP_ACCEPT_LANGUAGE': 'pt-br'})
00097 
00098         self.assertEquals(response.getStatus(), 200)
00099         self.failUnless('<option selected="selected" value="pt-br">'
00100             in response.getBody())
00101 
00102         # Test combined unsupported codes, should fall back
00103         response = self.publish(self.portal_path, self.basic_auth,
00104                                 env={'HTTP_ACCEPT_LANGUAGE': 'de-de'})
00105 
00106         self.assertEquals(response.getStatus(), 200)
00107         self.failUnless('<option selected="selected" value="de">'
00108             in response.getBody())
00109 


Member Data Documentation

Definition at line 16 of file test_negotiation.py.

Definition at line 17 of file test_negotiation.py.

Definition at line 18 of file test_negotiation.py.


The documentation for this class was generated from the following file: