comparison test/db_test_base.py @ 5261:53a853c06e9a

Fixed quiet history filter for linked items. Test for same fixed. The original test didn't cover the case where the linked item in the history/journal wasn't the same type as the item on which the history was generated. This now pulls the history on a user who has been linked to the nosy field of an issue.
author John Rouillard <rouilj@ieee.org>
date Mon, 28 Aug 2017 21:51:12 -0400
parents 198b6e810c67
children b5400cae9c2a
comparison
equal deleted inserted replaced
5260:29949f41cefb 5261:53a853c06e9a
981 981
982 def testViewPremJournal(self): 982 def testViewPremJournal(self):
983 pass 983 pass
984 984
985 def testQuietJournal(self): 985 def testQuietJournal(self):
986 ## This is an example of how to enable logging module
987 ## and report the results. It uses testfixtures
988 ## that can be installed via pip.
989 ## Uncomment below 2 lines:
990 import logging
991 from testfixtures import LogCapture
992 ## then run every call to roundup functions with:
993 #with LogCapture('roundup.hyperdb', level=logging.DEBUG) as l:
994 # result=self.db.user.history('2')
995 #print l
996 ## change 'roundup.hyperdb' to the logging name you want to capture.
997 ## print l just prints the output. Run using:
998 ## ./run_tests.py --capture=no -k testQuietJournal test/test_anydbm.py
999
986 # FIXME There should be a test via 1000 # FIXME There should be a test via
987 # template.py::_HTMLItem::history() and verify the output. 1001 # template.py::_HTMLItem::history() and verify the output.
988 # not sure how to get there from here. -- rouilj 1002 # not sure how to get there from here. -- rouilj
989 1003
990 # The Class::history() method now does filtering of quiet 1004 # The Class::history() method now does filtering of quiet
1098 # check piecewise 1112 # check piecewise
1099 self.assertEqual('1', id) 1113 self.assertEqual('1', id)
1100 self.assertEqual('1', user) 1114 self.assertEqual('1', user)
1101 self.assertEqual('set', action) 1115 self.assertEqual('set', action)
1102 self.assertEqual(expected, args) 1116 self.assertEqual(expected, args)
1117
1118 result=self.db.user.history('2')
1119
1120 # result should look like:
1121 # [('2', <Date 2017-08-29.01:42:44.283>, '1', 'link',
1122 # ('issue', '1', 'nosy')),
1123 # ('2', <Date 2017-08-29.01:42:40.227>, '1', 'create', {})]
1124
1125 expected2 = ('issue', '1', 'nosy')
1126 (id, tx_date, user, action, args) = result[0]
1127
1128 self.assertEqual(len(result),2)
1129
1130 self.assertEqual('2', id)
1131 self.assertEqual('1', user)
1132 self.assertEqual('link', action)
1133 self.assertEqual(expected2, args)
1103 1134
1104 # reset quiet props 1135 # reset quiet props
1105 self.db.issue.properties['nosy'].quiet=True 1136 self.db.issue.properties['nosy'].quiet=True
1106 self.db.issue.properties['deadline'].quiet=True 1137 self.db.issue.properties['deadline'].quiet=True
1107 1138

Roundup Issue Tracker: http://roundup-tracker.org/