Changeset - 5ca2a5e96793
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2011-11-21 02:26:48
marcin@python-works.com
fixed tests
2 files changed with 22 insertions and 17 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/functional/test_files.py
Show inline comments
 
@@ -12,17 +12,17 @@ class TestFilesController(TestController
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='index',
 
                                    repo_name=HG_REPO,
 
                                    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):
 
        self.log_user()
 

	
 
        response = self.app.get(url(controller='files', action='index',
 
@@ -31,15 +31,15 @@ class TestFilesController(TestController
 
                                    f_path='/'))
 

	
 

	
 

	
 
        #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'
 

	
 

	
 

	
 
    def test_index_different_branch(self):
rhodecode/tests/test_models.py
Show inline comments
 
@@ -172,35 +172,40 @@ class TestNotifications(unittest.TestCas
 
                                               name='u3', lastname='u3')
 

	
 

	
 

	
 
    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)
 

	
 
        Notification.delete(notification.notification_id)
 

	
 
        notifications = Notification.query().all()
0 comments (0 inline, 0 general)