Changeset - 623e1d68a2e0
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-06-26 22:20:08
marcin@python-works.com
fixed few test failures
3 files changed with 18 insertions and 14 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/functional/test_changelog.py
Show inline comments
 
from rhodecode.tests import *
 

	
 

	
 
class TestChangelogController(TestController):
 

	
 
    def test_index_hg(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO))
 

	
 
        response.mustcontain("""<div id="chg_20" class="container tablerow1">""")
 
        response.mustcontain(
 
            """<input class="changeset_range" id="5e204e7583b9" """
 
            """name="5e204e7583b9" type="checkbox" value="1" />"""
 
            """<input class="changeset_range" """
 
            """id="5e204e7583b9c8e7b93a020bd036564b1e731dae" """
 
            """name="5e204e7583b9c8e7b93a020bd036564b1e731dae" """
 
            """type="checkbox" value="1" />"""
 
        )
 
        response.mustcontain(
 
            """<span class="changeset_id">154:"""
 
            """<span class="changeset_hash">5e204e7583b9</span></span>"""
 
        )
 

	
 
        response.mustcontain("""Small update at simplevcs app""")
 

	
 
        response.mustcontain(
 
            """<div id="5e204e7583b9c8e7b93a020bd036564b1e731dae"  """
 
            """style="float:right;" class="changed_total tooltip" """
 
            """title="Affected number of files, click to show """
 
            """more details">3</div>"""
 
        )
 

	
 
        #pagination
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':1})
 
                                    repo_name=HG_REPO), {'page': 1})
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':2})
 
                                    repo_name=HG_REPO), {'page': 2})
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':3})
 
                                    repo_name=HG_REPO), {'page': 3})
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':4})
 
                                    repo_name=HG_REPO), {'page': 4})
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':5})
 
                                    repo_name=HG_REPO), {'page': 5})
 
        response = self.app.get(url(controller='changelog', action='index',
 
                                    repo_name=HG_REPO), {'page':6})
 
                                    repo_name=HG_REPO), {'page': 6})
 

	
 
        # Test response after pagination...
 
        response.mustcontain(
 
            """<input class="changeset_range" id="46ad32a4f974" """
 
            """name="46ad32a4f974" type="checkbox" value="1" />"""
 
            """<input class="changeset_range" """
 
            """id="46ad32a4f974e45472a898c6b0acb600320579b1" """
 
            """name="46ad32a4f974e45472a898c6b0acb600320579b1" """
 
            """type="checkbox" value="1" />"""
 
        )
 
        response.mustcontain(
 
            """<span class="changeset_id">64:"""
 
            """<span class="changeset_hash">46ad32a4f974</span></span>"""
 
        )
 

	
 
        response.mustcontain(
 
            """<div id="46ad32a4f974e45472a898c6b0acb600320579b1"  """
 
            """style="float:right;" class="changed_total tooltip" """
 
            """title="Affected number of files, click to show """
 
            """more details">21</div>"""
 
        )
rhodecode/tests/test_models.py
Show inline comments
 
@@ -253,32 +253,32 @@ class TestNotifications(unittest.TestCas
 
    def __init__(self, methodName='runTest'):
 
        Session.remove()
 
        self.u1 = UserModel().create_or_update(username=u'u1',
 
                                        password=u'qweqwe',
 
                                        email=u'u1@rhodecode.org',
 
                                        firstname=u'u1', lastname=u'u1')
 
        Session.commit()
 
        self.u1 = self.u1.user_id
 

	
 
        self.u2 = UserModel().create_or_update(username=u'u2',
 
                                        password=u'qweqwe',
 
                                        email=u'u2@rhodecode.org',
 
                                        name=u'u2', lastname=u'u3')
 
                                        firstname=u'u2', lastname=u'u3')
 
        Session.commit()
 
        self.u2 = self.u2.user_id
 

	
 
        self.u3 = UserModel().create_or_update(username=u'u3',
 
                                        password=u'qweqwe',
 
                                        email=u'u3@rhodecode.org',
 
                                        name=u'u3', lastname=u'u3')
 
                                        firstname=u'u3', lastname=u'u3')
 
        Session.commit()
 
        self.u3 = self.u3.user_id
 

	
 
        super(TestNotifications, self).__init__(methodName=methodName)
 

	
 
    def _clean_notifications(self):
 
        for n in Notification.query().all():
 
            Session.delete(n)
 

	
 
        Session.commit()
 
        self.assertEqual(Notification.query().all(), [])
 

	
rhodecode/tests/test_validators.py
Show inline comments
 
@@ -161,33 +161,33 @@ class TestReposGroups(unittest.TestCase)
 
        assert True
 

	
 
    @parameterized.expand([
 
        ('test', 'test'), ('lolz!', 'lolz'), ('  aavv', 'aavv'),
 
        ('ala ma kota', 'ala-ma-kota'), ('@nooo', 'nooo'),
 
        ('$!haha lolz !', 'haha-lolz'), ('$$$$$', ''), ('{}OK!', 'OK'),
 
        ('/]re po', 're-po')])
 
    def test_SlugifyName(self, name, expected):
 
        validator = v.SlugifyName()
 
        self.assertEqual(expected, validator.to_python(name))
 

	
 
    def test_ValidCloneUri(self):
 
            assert False
 
            self.fail('TODO:')
 

	
 
    def test_ValidForkType(self):
 
            validator = v.ValidForkType(old_data={'repo_type': 'hg'})
 
            self.assertEqual('hg', validator.to_python('hg'))
 
            self.assertRaises(formencode.Invalid, validator.to_python, 'git')
 

	
 
    def test_ValidPerms(self):
 
            assert False
 
            self.fail('TODO:')
 

	
 
    def test_ValidSettings(self):
 
        validator = v.ValidSettings()
 
        self.assertEqual({'pass': 'pass'},
 
                         validator.to_python(value={'user': 'test',
 
                                                    'pass': 'pass'}))
 

	
 
        self.assertEqual({'user2': 'test', 'pass': 'pass'},
 
                         validator.to_python(value={'user2': 'test',
 
                                                    'pass': 'pass'}))
 

	
 
    def test_ValidPath(self):
0 comments (0 inline, 0 general)