##// END OF EJS Templates
Fixed tests for new i18n changes...
marcink -
r2317:c4d8ed62 beta
parent child Browse files
Show More
@@ -18,4 +18,5 b' List of contributors to RhodeCode projec'
18 Aras Pranckevicius <aras@unity3d.com>
18 Aras Pranckevicius <aras@unity3d.com>
19 Tony Bussieres <t.bussieres@gmail.com>
19 Tony Bussieres <t.bussieres@gmail.com>
20 Erwin Kroon <e.kroon@smartmetersolutions.nl>
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 repo_name=HG_REPO, revision=rev))
40 repo_name=HG_REPO, revision=rev))
41 # test DB
41 # test DB
42 self.assertEqual(ChangesetComment.query().count(), 1)
42 self.assertEqual(ChangesetComment.query().count(), 1)
43 self.assertTrue('''<div class="comments-number">%s '''
43 response.mustcontain('''<div class="comments-number">%s comment '''
44 '''comment(s) (0 inline)</div>''' % 1 in response.body)
44 '''(0 inline)</div>''' % 1)
45
45
46 self.assertEqual(Notification.query().count(), 1)
46 self.assertEqual(Notification.query().count(), 1)
47 self.assertEqual(ChangesetComment.query().count(), 1)
47 self.assertEqual(ChangesetComment.query().count(), 1)
@@ -76,7 +76,7 b' class TestChangeSetCommentsController(Te'
76 #test DB
76 #test DB
77 self.assertEqual(ChangesetComment.query().count(), 1)
77 self.assertEqual(ChangesetComment.query().count(), 1)
78 response.mustcontain(
78 response.mustcontain(
79 '''<div class="comments-number">0 comment(s)'''
79 '''<div class="comments-number">0 comments'''
80 ''' (%s inline)</div>''' % 1
80 ''' (%s inline)</div>''' % 1
81 )
81 )
82 response.mustcontain(
82 response.mustcontain(
@@ -115,8 +115,8 b' class TestChangeSetCommentsController(Te'
115 repo_name=HG_REPO, revision=rev))
115 repo_name=HG_REPO, revision=rev))
116 # test DB
116 # test DB
117 self.assertEqual(ChangesetComment.query().count(), 1)
117 self.assertEqual(ChangesetComment.query().count(), 1)
118 self.assertTrue('''<div class="comments-number">%s '''
118 response.mustcontain('''<div class="comments-number">%s '''
119 '''comment(s) (0 inline)</div>''' % 1 in response.body)
119 '''comment (0 inline)</div>''' % 1)
120
120
121 self.assertEqual(Notification.query().count(), 2)
121 self.assertEqual(Notification.query().count(), 2)
122 users = [x.user.username for x in UserNotification.query().all()]
122 users = [x.user.username for x in UserNotification.query().all()]
@@ -148,5 +148,5 b' class TestChangeSetCommentsController(Te'
148
148
149 response = self.app.get(url(controller='changeset', action='index',
149 response = self.app.get(url(controller='changeset', action='index',
150 repo_name=HG_REPO, revision=rev))
150 repo_name=HG_REPO, revision=rev))
151 self.assertTrue('''<div class="comments-number">0 comment(s)'''
151 response.mustcontain('''<div class="comments-number">0 comments'''
152 ''' (0 inline)</div>''' in response.body)
152 ''' (0 inline)</div>''')
@@ -23,10 +23,10 b''
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
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 proto = 'http'
31 proto = 'http'
32 TEST_URLS = [
32 TEST_URLS = [
@@ -116,3 +116,16 b' class TestLibs(unittest.TestCase):'
116 'marian.user', 'marco-polo', 'marco_polo'
116 'marian.user', 'marco-polo', 'marco_polo'
117 ], key=lambda k: k.lower())
117 ], key=lambda k: k.lower())
118 self.assertEqual(s, extract_mentioned_users(sample))
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