Changeset - 63e49418a4cc
[Not reviewed]
beta
0 7 0
Marcin Kuzminski - 13 years ago 2013-03-31 21:44:27
marcin@python-works.com
Use only mustcontain for testing response body
7 files changed with 31 insertions and 25 deletions:
0 comments (0 inline, 0 general)
rhodecode/tests/__init__.py
Show inline comments
 
@@ -33,6 +33,7 @@ from paste.script.appinstall import Setu
 
from pylons import config, url
 
from routes.util import URLGenerator
 
from webtest import TestApp
 
from nose.plugins.skip import SkipTest
 

	
 
from rhodecode import is_windows
 
from rhodecode.model.meta import Session
 
@@ -51,6 +52,7 @@ log = logging.getLogger(__name__)
 

	
 
__all__ = [
 
    'parameterized', 'environ', 'url', 'get_new_dir', 'TestController',
 
    'SkipTest',
 
    'TESTS_TMP_PATH', 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO',
 
    'HG_FORK', 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS',
 
    'TEST_USER_REGULAR_LOGIN', 'TEST_USER_REGULAR_PASS',
rhodecode/tests/functional/test_admin_ldap_settings.py
Show inline comments
 
from rhodecode.tests import *
 
from rhodecode.model.db import RhodeCodeSetting
 
from nose.plugins.skip import SkipTest
 

	
 
skip_ldap_test = False
 
try:
 
@@ -17,7 +16,7 @@ class TestLdapSettingsController(TestCon
 
        self.log_user()
 
        response = self.app.get(url(controller='admin/ldap_settings',
 
                                    action='index'))
 
        self.assertTrue('LDAP administration' in response.body)
 
        response.mustcontain('LDAP administration')
 

	
 
    def test_ldap_save_settings(self):
 
        self.log_user()
 
@@ -72,14 +71,12 @@ class TestLdapSettingsController(TestCon
 
                    'ldap_attr_lastname':'',
 
                    'ldap_attr_email':'' })
 

	
 
        self.assertTrue("""<span class="error-message">The LDAP Login"""
 
                        """ attribute of the CN must be specified""" in
 
                        response.body)
 
        response.mustcontain("""<span class="error-message">The LDAP Login"""
 
                             """ attribute of the CN must be specified""")
 

	
 

	
 

	
 
        self.assertTrue("""<span class="error-message">Please """
 
                        """enter a number</span>""" in response.body)
 
        response.mustcontain("""<span class="error-message">Please """
 
                             """enter a number</span>""")
 

	
 
    def test_ldap_login(self):
 
        pass
rhodecode/tests/functional/test_admin_notifications.py
Show inline comments
 
@@ -22,8 +22,7 @@ class TestNotificationsController(TestCo
 
        u1 = u1.user_id
 

	
 
        response = self.app.get(url('notifications'))
 
        self.assertTrue('''<div class="table">No notifications here yet</div>'''
 
                        in response.body)
 
        response.mustcontain('<div class="table">No notifications here yet</div>')
 

	
 
        cur_user = self._get_logged_user()
 

	
 
@@ -32,7 +31,7 @@ class TestNotificationsController(TestCo
 
                                   recipients=[cur_user])
 
        self.Session().commit()
 
        response = self.app.get(url('notifications'))
 
        self.assertTrue(u'test_notification_1' in response.body)
 
        response.mustcontain(u'test_notification_1')
 

	
 
#    def test_index_as_xml(self):
 
#        response = self.app.get(url('formatted_notifications', format='xml'))
rhodecode/tests/functional/test_admin_settings.py
Show inline comments
 
@@ -90,8 +90,7 @@ class TestAdminSettingsController(TestCo
 
                        .get_app_settings()['rhodecode_ga_code'], new_ga_code)
 

	
 
        response = response.follow()
 
        self.assertFalse("""_gaq.push(['_setAccount', '%s']);""" % new_ga_code
 
                         in response.body)
 
        response.mustcontain(no=["_gaq.push(['_setAccount', '%s']);" % new_ga_code])
 

	
 
    def test_title_change(self):
 
        self.log_user()
 
@@ -120,7 +119,7 @@ class TestAdminSettingsController(TestCo
 
        self.log_user()
 
        response = self.app.get(url('admin_settings_my_account'))
 

	
 
        self.assertTrue('value="test_admin' in response.body)
 
        response.mustcontain('value="test_admin')
 

	
 
    @parameterized.expand([('firstname', 'new_username'),
 
                           ('lastname', 'new_username'),
 
@@ -217,7 +216,7 @@ class TestAdminSettingsController(TestCo
 
        repo = Repository.get_by_repo_name(HG_REPO)
 
        response = self.app.get(url('edit_repo', repo_name=HG_REPO))
 
        opt = """<option value="%s">vcs_test_git</option>""" % repo.repo_id
 
        assert opt not in response.body
 
        response.mustcontain(no=[opt])
 

	
 
    def test_set_fork_of_repo(self):
 
        self.log_user()
rhodecode/tests/functional/test_followers.py
Show inline comments
 
from rhodecode.tests import *
 

	
 

	
 
class TestFollowersController(TestController):
 

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

	
 
        self.assertTrue("""test_admin""" in response.body)
 
        self.assertTrue("""Started following""" in response.body)
 
        response.mustcontain("""test_admin""")
 
        response.mustcontain("""Started following""")
 

	
 
    def test_index_git(self):
 
        self.log_user()
 
        repo_name = GIT_REPO
 
        response = self.app.get(url(controller='followers',
 
                                    action='followers',
 
                                    repo_name=repo_name))
 

	
 
        response.mustcontain("""test_admin""")
 
        response.mustcontain("""Started following""")
rhodecode/tests/functional/test_forks.py
Show inline comments
 
@@ -27,7 +27,7 @@ class TestForksController(TestController
 
        response = self.app.get(url(controller='forks', action='forks',
 
                                    repo_name=repo_name))
 

	
 
        self.assertTrue("""There are no forks yet""" in response.body)
 
        response.mustcontain("""There are no forks yet""")
 

	
 
    def test_no_permissions_to_fork(self):
 
        usr = self.log_user(TEST_USER_REGULAR_LOGIN,
 
@@ -135,7 +135,7 @@ class TestForksController(TestController
 
        response = self.app.get(url(controller='summary', action='index',
 
                                    repo_name=fork_name))
 

	
 
        self.assertTrue('Fork of %s' % repo_name in response.body)
 
        response.mustcontain('Fork of %s' % repo_name)
 

	
 
    def test_zz_fork_permission_page(self):
 
        usr = self.log_user(self.username, self.password)['user_id']
rhodecode/tests/functional/test_search.py
Show inline comments
 
import os
 
from rhodecode.tests import *
 
from nose.plugins.skip import SkipTest
 

	
 

	
 
class TestSearchController(TestController):
 
@@ -9,8 +8,7 @@ class TestSearchController(TestControlle
 
        self.log_user()
 
        response = self.app.get(url(controller='search', action='index'))
 

	
 
        self.assertTrue('class="small" id="q" name="q" type="text"' in
 
                        response.body)
 
        response.mustcontain('class="small" id="q" name="q" type="text"')
 
        # Test response...
 

	
 
    def test_empty_search(self):
 
@@ -20,8 +18,8 @@ class TestSearchController(TestControlle
 
            self.log_user()
 
            response = self.app.get(url(controller='search', action='index'),
 
                                    {'q': HG_REPO})
 
            self.assertTrue('There is no index to search in. '
 
                            'Please run whoosh indexer' in response.body)
 
            response.mustcontain('There is no index to search in. '
 
                                 'Please run whoosh indexer')
 

	
 
    def test_normal_search(self):
 
        self.log_user()
0 comments (0 inline, 0 general)