changeset 1709:5ca2a5e96793 beta

fixed tests
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 21 Nov 2011 03:26:48 +0200
parents fee9895fa46e
children 79a06e68a035
files rhodecode/tests/functional/test_files.py rhodecode/tests/test_models.py
diffstat 2 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/tests/functional/test_files.py	Mon Nov 21 03:08:09 2011 +0200
+++ b/rhodecode/tests/functional/test_files.py	Mon Nov 21 03:26:48 2011 +0200
@@ -15,11 +15,11 @@
                                     revision='tip',
                                     f_path='/'))
         # Test response...
-        assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>' in response.body, 'missing dir'
-        assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>' in response.body, 'missing dir'
-        assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>' in response.body, 'missing dir'
-        assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>' in response.body, 'missing file'
-        assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>' in response.body, 'missing file'
+        assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>' in response.body, 'missing dir'
+        assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>' in response.body, 'missing dir'
+        assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>' in response.body, 'missing dir'
+        assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>' in response.body, 'missing file'
+        assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>' in response.body, 'missing file'
 
 
     def test_index_revision(self):
@@ -34,9 +34,9 @@
 
         #Test response...
 
-        assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>' in response.body, 'missing dir'
-        assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>' in response.body, 'missing dir'
-        assert '<a class="browser-file" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>' in response.body, 'missing file'
+        assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>' in response.body, 'missing dir'
+        assert '<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>' in response.body, 'missing dir'
+        assert '<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>' in response.body, 'missing file'
         assert '1.1 KiB' in response.body, 'missing size of setup.py'
         assert 'text/x-python' in response.body, 'missing mimetype of setup.py'
 
--- a/rhodecode/tests/test_models.py	Mon Nov 21 03:08:09 2011 +0200
+++ b/rhodecode/tests/test_models.py	Mon Nov 21 03:26:48 2011 +0200
@@ -175,29 +175,34 @@
 
     def test_create_notification(self):
         usrs = [self.u1, self.u2]
-        notification = Notification.create(subject='subj', body='hi there',
-                            recipients=usrs)
+        notification = Notification.create(created_by=self.u1,
+                                           subject='subj', body='hi there',
+                                           recipients=usrs)
 
         notifications = Session.query(Notification).all()
         unotification = UserNotification.query()\
             .filter(UserNotification.notification == notification).all()
         self.assertEqual(len(notifications), 1)
         self.assertEqual(notifications[0].recipients, [self.u1, self.u2])
-        self.assertEqual(notification, notifications[0])
+        self.assertEqual(notification.notification_id,
+                         notifications[0].notification_id)
         self.assertEqual(len(unotification), len(usrs))
         self.assertEqual([x.user.user_id for x in unotification],
                          [x.user_id for x in usrs])
 
     def test_user_notifications(self):
-        notification1 = Notification.create(subject='subj', body='hi there',
-                            recipients=[self.u3])
-        notification2 = Notification.create(subject='subj', body='hi there',
-                            recipients=[self.u3])
+        notification1 = Notification.create(created_by=self.u1,
+                                            subject='subj', body='hi there',
+                                            recipients=[self.u3])
+        notification2 = Notification.create(created_by=self.u1,
+                                            subject='subj', body='hi there',
+                                            recipients=[self.u3])
         self.assertEqual(self.u3.notifications, [notification1, notification2])
 
     def test_delete_notifications(self):
-        notification = Notification.create(subject='title', body='hi there3',
-                            recipients=[self.u3, self.u1, self.u2])
+        notification = Notification.create(created_by=self.u1,
+                                           subject='title', body='hi there3',
+                                    recipients=[self.u3, self.u1, self.u2])
         notifications = Notification.query().all()
         self.assertTrue(notification in notifications)