Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
test_Hits.TestHits Class Reference
Collaboration diagram for test_Hits.TestHits:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setup_class
def teardown_class
def testHitsNoArg
def testHitsForAll
def testHitsForFilter
def testHitsForAllAndFilter

Public Attributes

 page

Static Public Attributes

string pagename = u'AutoCreatedMoinMoinTemporaryTestPageForHits'

Private Member Functions

def _test_macro
def _cleanStats

Detailed Description

Hits: testing Hits macro 

Definition at line 16 of file test_Hits.py.


Member Function Documentation

def test_Hits.TestHits._cleanStats (   self) [private]

Definition at line 36 of file test_Hits.py.

00036 
00037     def _cleanStats(self):
00038         # cleans all involved cache and log files
00039         nuke_eventlog(self.request)
00040         # hits is based on hitcounts which reads the cache
00041         caching.CacheEntry(self.request, 'charts', 'hitcounts', scope='wiki').remove()
00042         arena = Page(self.request, self.pagename)
00043         caching.CacheEntry(self.request, arena, 'hitcounts', scope='item').remove()

Here is the call graph for this function:

Here is the caller graph for this function:

def test_Hits.TestHits._test_macro (   self,
  name,
  args 
) [private]

Definition at line 32 of file test_Hits.py.

00032 
00033     def _test_macro(self, name, args):
00034         m = make_macro(self.request, self.page)
00035         return m.execute(name, args)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 20 of file test_Hits.py.

00020 
00021     def setup_class(self):
00022         request = self.request
00023         become_trusted(request)
00024         self.page = create_page(request, self.pagename, u"Foo!")
00025         # for that test eventlog needs to be empty
00026         nuke_eventlog(request)
00027         # hits is based on hitcounts which reads the cache
00028         caching.CacheEntry(request, 'charts', 'hitcounts', scope='wiki').remove()

Here is the call graph for this function:

Definition at line 29 of file test_Hits.py.

00029 
00030     def teardown_class(self):
00031         nuke_page(self.request, self.pagename)

Here is the call graph for this function:

macro Hits test: 'all=True' for Hits (all pages are counted for VIEWPAGE) 

Definition at line 55 of file test_Hits.py.

00055 
00056     def testHitsForAll(self):
00057         """ macro Hits test: 'all=True' for Hits (all pages are counted for VIEWPAGE) """
00058         # <count> * <num_pages> log entries for simulating viewing
00059         pagenames = ['WikiSandBox', self.pagename]
00060         num_pages = len(pagenames)
00061         count = 2
00062         for i in range(count):
00063             for pagename in pagenames:
00064                 eventlog.EventLog(self.request).add(self.request, 'VIEWPAGE', {'pagename': pagename})
00065         result = self._test_macro(u'Hits', u'all=True')
00066         self._cleanStats()
00067         assert result == str(count * num_pages)

Here is the call graph for this function:

macro test: 'all=True, event_type=SAVEPAGE' for Hits (all pages are counted for SAVEPAGE)

Definition at line 77 of file test_Hits.py.

00077 
00078     def testHitsForAllAndFilter(self):
00079         """ macro test: 'all=True, event_type=SAVEPAGE' for Hits (all pages are counted for SAVEPAGE)"""
00080         eventlog.EventLog(self.request).add(self.request, 'SAVEPAGE', {'pagename': 'WikiSandBox'})
00081         eventlog.EventLog(self.request).add(self.request, 'SAVEPAGE', {'pagename': self.pagename})
00082         result = self._test_macro(u'Hits', u'all=True, event_type=SAVEPAGE')
00083         self._cleanStats()
00084         assert result == "2"

Here is the call graph for this function:

macro Hits test: 'event_type=SAVEPAGE' for Hits (SAVEPAGE counted for current page)

Definition at line 68 of file test_Hits.py.

00068 
00069     def testHitsForFilter(self):
00070         """ macro Hits test: 'event_type=SAVEPAGE' for Hits (SAVEPAGE counted for current page)"""
00071         eventlog.EventLog(self.request).add(self.request, 'SAVEPAGE', {'pagename': self.pagename})
00072         # simulate a log entry SAVEPAGE for WikiSandBox to destinguish current page
00073         eventlog.EventLog(self.request).add(self.request, 'SAVEPAGE', {'pagename': 'WikiSandBox'})
00074         result = self._test_macro(u'Hits', u'event_type=SAVEPAGE')
00075         self._cleanStats()
00076         assert result == "1"

Here is the call graph for this function:

macro Hits test: 'no args for Hits (Hits is executed on current page) 

Definition at line 44 of file test_Hits.py.

00044 
00045     def testHitsNoArg(self):
00046         """ macro Hits test: 'no args for Hits (Hits is executed on current page) """
00047         # <count> log entries for the current page and one for WikiSandBox simulating viewing
00048         count = 3
00049         eventlog.EventLog(self.request).add(self.request, 'VIEWPAGE', {'pagename': 'WikiSandBox'})
00050         for i in range(count):
00051             eventlog.EventLog(self.request).add(self.request, 'VIEWPAGE', {'pagename': self.pagename})
00052         result = self._test_macro(u'Hits', u'')
00053         self._cleanStats()
00054         assert result == str(count)

Here is the call graph for this function:


Member Data Documentation

Definition at line 23 of file test_Hits.py.

string test_Hits.TestHits.pagename = u'AutoCreatedMoinMoinTemporaryTestPageForHits' [static]

Definition at line 18 of file test_Hits.py.


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