##// END OF EJS Templates
fixed tests
marcink -
r1709:5ca2a5e9 beta
parent child Browse files
Show More
@@ -15,11 +15,11 b' class TestFilesController(TestController'
15 revision='tip',
15 revision='tip',
16 f_path='/'))
16 f_path='/'))
17 # Test response...
17 # Test response...
18 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>' in response.body, 'missing dir'
18 assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>' in response.body, 'missing dir'
19 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>' in response.body, 'missing dir'
19 assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>' in response.body, 'missing dir'
20 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>' in response.body, 'missing dir'
20 assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>' in response.body, 'missing dir'
21 assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>' in response.body, 'missing file'
21 assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>' in response.body, 'missing file'
22 assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>' in response.body, 'missing file'
22 assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>' in response.body, 'missing file'
23
23
24
24
25 def test_index_revision(self):
25 def test_index_revision(self):
@@ -34,9 +34,9 b' class TestFilesController(TestController'
34
34
35 #Test response...
35 #Test response...
36
36
37 assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>' in response.body, 'missing dir'
37 assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>' in response.body, 'missing dir'
38 assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>' in response.body, 'missing dir'
38 assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>' in response.body, 'missing dir'
39 assert '<a class="browser-file" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>' in response.body, 'missing file'
39 assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>' in response.body, 'missing file'
40 assert '1.1 KiB' in response.body, 'missing size of setup.py'
40 assert '1.1 KiB' in response.body, 'missing size of setup.py'
41 assert 'text/x-python' in response.body, 'missing mimetype of setup.py'
41 assert 'text/x-python' in response.body, 'missing mimetype of setup.py'
42
42
@@ -175,29 +175,34 b' class TestNotifications(unittest.TestCas'
175
175
176 def test_create_notification(self):
176 def test_create_notification(self):
177 usrs = [self.u1, self.u2]
177 usrs = [self.u1, self.u2]
178 notification = Notification.create(subject='subj', body='hi there',
178 notification = Notification.create(created_by=self.u1,
179 recipients=usrs)
179 subject='subj', body='hi there',
180 recipients=usrs)
180
181
181 notifications = Session.query(Notification).all()
182 notifications = Session.query(Notification).all()
182 unotification = UserNotification.query()\
183 unotification = UserNotification.query()\
183 .filter(UserNotification.notification == notification).all()
184 .filter(UserNotification.notification == notification).all()
184 self.assertEqual(len(notifications), 1)
185 self.assertEqual(len(notifications), 1)
185 self.assertEqual(notifications[0].recipients, [self.u1, self.u2])
186 self.assertEqual(notifications[0].recipients, [self.u1, self.u2])
186 self.assertEqual(notification, notifications[0])
187 self.assertEqual(notification.notification_id,
188 notifications[0].notification_id)
187 self.assertEqual(len(unotification), len(usrs))
189 self.assertEqual(len(unotification), len(usrs))
188 self.assertEqual([x.user.user_id for x in unotification],
190 self.assertEqual([x.user.user_id for x in unotification],
189 [x.user_id for x in usrs])
191 [x.user_id for x in usrs])
190
192
191 def test_user_notifications(self):
193 def test_user_notifications(self):
192 notification1 = Notification.create(subject='subj', body='hi there',
194 notification1 = Notification.create(created_by=self.u1,
193 recipients=[self.u3])
195 subject='subj', body='hi there',
194 notification2 = Notification.create(subject='subj', body='hi there',
196 recipients=[self.u3])
195 recipients=[self.u3])
197 notification2 = Notification.create(created_by=self.u1,
198 subject='subj', body='hi there',
199 recipients=[self.u3])
196 self.assertEqual(self.u3.notifications, [notification1, notification2])
200 self.assertEqual(self.u3.notifications, [notification1, notification2])
197
201
198 def test_delete_notifications(self):
202 def test_delete_notifications(self):
199 notification = Notification.create(subject='title', body='hi there3',
203 notification = Notification.create(created_by=self.u1,
200 recipients=[self.u3, self.u1, self.u2])
204 subject='title', body='hi there3',
205 recipients=[self.u3, self.u1, self.u2])
201 notifications = Notification.query().all()
206 notifications = Notification.query().all()
202 self.assertTrue(notification in notifications)
207 self.assertTrue(notification in notifications)
203
208
General Comments 0
You need to be logged in to leave comments. Login now