Show More
@@ -18,4 +18,5 b' List of contributors to RhodeCode projec' | |||
|
18 | 18 | Aras Pranckevicius <aras@unity3d.com> |
|
19 | 19 | Tony Bussieres <t.bussieres@gmail.com> |
|
20 | 20 | Erwin Kroon <e.kroon@smartmetersolutions.nl> |
|
21 | nansenat16 <nansenat16@null.tw> No newline at end of file | |
|
21 | nansenat16 <nansenat16@null.tw> | |
|
22 | Vincent Duvert <vincent@duvert.net> No newline at end of file |
@@ -40,8 +40,8 b' class TestChangeSetCommentsController(Te' | |||
|
40 | 40 | repo_name=HG_REPO, revision=rev)) |
|
41 | 41 | # test DB |
|
42 | 42 | self.assertEqual(ChangesetComment.query().count(), 1) |
|
43 |
se |
|
|
44 |
''' |
|
|
43 | response.mustcontain('''<div class="comments-number">%s comment ''' | |
|
44 | '''(0 inline)</div>''' % 1) | |
|
45 | 45 | |
|
46 | 46 | self.assertEqual(Notification.query().count(), 1) |
|
47 | 47 | self.assertEqual(ChangesetComment.query().count(), 1) |
@@ -76,7 +76,7 b' class TestChangeSetCommentsController(Te' | |||
|
76 | 76 | #test DB |
|
77 | 77 | self.assertEqual(ChangesetComment.query().count(), 1) |
|
78 | 78 | response.mustcontain( |
|
79 |
'''<div class="comments-number">0 comment |
|
|
79 | '''<div class="comments-number">0 comments''' | |
|
80 | 80 | ''' (%s inline)</div>''' % 1 |
|
81 | 81 | ) |
|
82 | 82 | response.mustcontain( |
@@ -115,8 +115,8 b' class TestChangeSetCommentsController(Te' | |||
|
115 | 115 | repo_name=HG_REPO, revision=rev)) |
|
116 | 116 | # test DB |
|
117 | 117 | self.assertEqual(ChangesetComment.query().count(), 1) |
|
118 |
se |
|
|
119 |
'''comment |
|
|
118 | response.mustcontain('''<div class="comments-number">%s ''' | |
|
119 | '''comment (0 inline)</div>''' % 1) | |
|
120 | 120 | |
|
121 | 121 | self.assertEqual(Notification.query().count(), 2) |
|
122 | 122 | users = [x.user.username for x in UserNotification.query().all()] |
@@ -148,5 +148,5 b' class TestChangeSetCommentsController(Te' | |||
|
148 | 148 | |
|
149 | 149 | response = self.app.get(url(controller='changeset', action='index', |
|
150 | 150 | repo_name=HG_REPO, revision=rev)) |
|
151 |
se |
|
|
152 |
''' (0 inline)</div>''' |
|
|
151 | response.mustcontain('''<div class="comments-number">0 comments''' | |
|
152 | ''' (0 inline)</div>''') |
@@ -23,10 +23,10 b'' | |||
|
23 | 23 | # You should have received a copy of the GNU General Public License |
|
24 | 24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25 | 25 | |
|
26 | ||
|
26 | import unittest | |
|
27 | import datetime | |
|
28 | from rhodecode.tests import * | |
|
27 | 29 | |
|
28 | import unittest | |
|
29 | from rhodecode.tests import * | |
|
30 | 30 | |
|
31 | 31 | proto = 'http' |
|
32 | 32 | TEST_URLS = [ |
@@ -116,3 +116,16 b' class TestLibs(unittest.TestCase):' | |||
|
116 | 116 | 'marian.user', 'marco-polo', 'marco_polo' |
|
117 | 117 | ], key=lambda k: k.lower()) |
|
118 | 118 | self.assertEqual(s, extract_mentioned_users(sample)) |
|
119 | ||
|
120 | def test_age(self): | |
|
121 | from rhodecode.lib.utils2 import age | |
|
122 | n = datetime.datetime.now() | |
|
123 | delt = lambda *args, **kwargs: datetime.timedelta(*args, **kwargs) | |
|
124 | self.assertEqual(age(n), u'just now') | |
|
125 | self.assertEqual(age(n - delt(seconds=1)), u'1 second ago') | |
|
126 | self.assertEqual(age(n - delt(seconds=60 * 2)), u'2 minutes ago') | |
|
127 | self.assertEqual(age(n - delt(hours=1)), u'1 hour ago') | |
|
128 | self.assertEqual(age(n - delt(hours=24)), u'1 day ago') | |
|
129 | self.assertEqual(age(n - delt(hours=24 * 5)), u'5 days ago') | |
|
130 | self.assertEqual(age(n - delt(hours=24 * 32)), u'1 month and 2 days ago') | |
|
131 | self.assertEqual(age(n - delt(hours=24 * 400)), u'1 year and 1 month ago') |
General Comments 0
You need to be logged in to leave comments.
Login now