Attachment 'test_strings.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - tests i18n strings definition of page names
4
5 @copyright: 2009 MoinMoin:ReimarBauer
6
7 @license: GNU GPL, see COPYING for details.
8 """
9
10 from MoinMoin.i18n import strings
11 from MoinMoin.Page import Page
12
13
14 class TestStrings:
15 """
16 tests page name strings of i18n
17 """
18 def underlay_pages(self, language='en'):
19 underlay_page_list = []
20 for name in self.request.rootpage.getPageList(exists=1):
21 page = Page(self.request, name)
22 if page.getPageStatus()[0] and page.pi['language'] == language:
23 # is an underlay page in the wanted language
24 underlay_page_list.append(name)
25 return underlay_page_list
26
27 def testUniqueStringNames(self):
28 """
29 tests if given names from strings.all_pages are unique defined
30 """
31 assert len(list(set(strings.all_pages))) == len(strings.all_pages)
32
33 def testStringPageIsUnderlayPage(self):
34 """
35 tests if the page in the strings.all_pages list is defined as underlay page
36 """
37 underlay_pages = self.underlay_pages('en')
38 missing_pages = [page_name for page_name in strings.all_pages if page_name not in underlay_pages]
39 assert missing_pages == []
40
41 def testOrphanedUnderlayPage(self):
42 """
43 tests if we have in underlay pages which don't be listed in strings.all_pages
44 """
45 orphaned_pages = []
46 underlay_pages = self.underlay_pages('en')
47 orphaned_pages = [page_name for page_name in underlay_pages if page_name not in strings.all_pages]
48 #orph = '\n'.join(orphaned_pages)
49 #open('/tmp/orphaned.txt', 'w').write(orph.encode('utf-8'))
50 assert orphaned_pages == []
51
52 coverage_modules = ['MoinMoin.i18n.strings']
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.