Mercurial > p > roundup > code
comparison test/test_actions.py @ 6303:2ded9a8be017
Test :lastactivity special variable for lastUserActivity()
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 21 Dec 2020 00:00:39 -0500 |
| parents | 45ba6b71f1cf |
| children | 68d83479747b |
comparison
equal
deleted
inserted
replaced
| 6302:314691b81ee0 | 6303:2ded9a8be017 |
|---|---|
| 1 from __future__ import print_function | 1 from __future__ import print_function |
| 2 import unittest | 2 import unittest, copy |
| 3 from cgi import FieldStorage, MiniFieldStorage | 3 from cgi import FieldStorage, MiniFieldStorage |
| 4 | 4 |
| 5 from roundup import hyperdb | 5 from roundup import hyperdb |
| 6 from roundup.date import Date, Interval | 6 from roundup.date import Date, Interval |
| 7 from roundup.cgi.actions import * | 7 from roundup.cgi.actions import * |
| 240 self.now.second = int(self.now.second) | 240 self.now.second = int(self.now.second) |
| 241 | 241 |
| 242 def testLastUserActivity(self): | 242 def testLastUserActivity(self): |
| 243 self.assertEqual(self.action.lastUserActivity(), None) | 243 self.assertEqual(self.action.lastUserActivity(), None) |
| 244 | 244 |
| 245 # copy corm value. Once we apend to it we can't delete | |
| 246 # anything so save a copy for the second test case. | |
| 247 base_form = copy.copy(self.client.form.value) | |
| 248 | |
| 249 # test @ special variable form | |
| 245 self.client.form.value.append( | 250 self.client.form.value.append( |
| 246 MiniFieldStorage('@lastactivity', str(self.now))) | 251 MiniFieldStorage('@lastactivity', str(self.now))) |
| 252 self.assertEqual(self.action.lastUserActivity(), self.now) | |
| 253 | |
| 254 # test : special variable form | |
| 255 self.client.form.value = base_form | |
| 256 self.client.form.value.append( | |
| 257 MiniFieldStorage(':lastactivity', str(self.now))) | |
| 247 self.assertEqual(self.action.lastUserActivity(), self.now) | 258 self.assertEqual(self.action.lastUserActivity(), self.now) |
| 248 | 259 |
| 249 def testLastNodeActivity(self): | 260 def testLastNodeActivity(self): |
| 250 self.action.classname = 'issue' | 261 self.action.classname = 'issue' |
| 251 self.action.nodeid = '1' | 262 self.action.nodeid = '1' |
