Back to index

moin  1.9.0~rc2
test_StatsChart.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - MoinMoin.macro StatsChart tested
00004 
00005     @copyright: 2008 MoinMoin:ReimarBauer
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 import os
00009 
00010 from MoinMoin import caching, macro
00011 from MoinMoin.logfile import eventlog
00012 from MoinMoin.PageEditor import PageEditor
00013 from MoinMoin.Page import Page
00014 from MoinMoin._tests import become_trusted, create_page, make_macro, nuke_page
00015 
00016 class TestStatsCharts:
00017     """StartsChart: testing StatsChart macro """
00018     pagename = u'AutoCreatedMoinMoinTemporaryTestPageStatsChart'
00019 
00020     def setup_class(self):
00021         become_trusted(self.request)
00022         self.page = create_page(self.request, self.pagename, u"Foo!")
00023         # clean page scope cache entries
00024         for key in ['text_html', 'pagelinks', ]:
00025             caching.CacheEntry(self.request, self.page, key, scope='item').remove()
00026 
00027     def teardown_class(self):
00028         nuke_page(self.request, self.pagename)
00029 
00030     def _test_macro(self, name, args):
00031         m = make_macro(self.request, self.page)
00032         return m.execute(name, args)
00033 
00034     def testStatsChart_useragents(self):
00035         """ macro StatsChart useragents test: 'tests useragents' and clean page scope cache """
00036         result = self._test_macro(u'StatsChart', u'useragents')
00037         expected = u'<form action="/AutoCreatedMoinMoinTemporaryTestPageStatsChart" method="GET"'
00038         assert expected in result
00039 
00040     def testStatsChart_hitcounts(self):
00041         """ macro StatsChart hitcounts test: 'tests hitcounts' and clean page scope cache  """
00042         result = self._test_macro(u'StatsChart', u'hitcounts')
00043         expected = u'<form action="/AutoCreatedMoinMoinTemporaryTestPageStatsChart" method="GET"'
00044         assert expected in result
00045 
00046     def testStatsChart_languages(self):
00047         """ macro StatsChart languages test: 'tests languages' and clean page scope cache  """
00048         result = self._test_macro(u'StatsChart', u'hitcounts')
00049         expected = u'<form action="/AutoCreatedMoinMoinTemporaryTestPageStatsChart" method="GET"'
00050         assert expected in result
00051 
00052 coverage_modules = ['MoinMoin.stats']