diff --git a/rhodecode/tests/__init__.py b/rhodecode/tests/__init__.py --- a/rhodecode/tests/__init__.py +++ b/rhodecode/tests/__init__.py @@ -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', diff --git a/rhodecode/tests/functional/test_admin_ldap_settings.py b/rhodecode/tests/functional/test_admin_ldap_settings.py --- a/rhodecode/tests/functional/test_admin_ldap_settings.py +++ b/rhodecode/tests/functional/test_admin_ldap_settings.py @@ -1,6 +1,5 @@ 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("""The LDAP Login""" - """ attribute of the CN must be specified""" in - response.body) + response.mustcontain("""The LDAP Login""" + """ attribute of the CN must be specified""") - - self.assertTrue("""Please """ - """enter a number""" in response.body) + response.mustcontain("""Please """ + """enter a number""") def test_ldap_login(self): pass diff --git a/rhodecode/tests/functional/test_admin_notifications.py b/rhodecode/tests/functional/test_admin_notifications.py --- a/rhodecode/tests/functional/test_admin_notifications.py +++ b/rhodecode/tests/functional/test_admin_notifications.py @@ -22,8 +22,7 @@ class TestNotificationsController(TestCo u1 = u1.user_id response = self.app.get(url('notifications')) - self.assertTrue('''
No notifications here yet
''' - in response.body) + response.mustcontain('
No notifications here yet
') 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')) diff --git a/rhodecode/tests/functional/test_admin_settings.py b/rhodecode/tests/functional/test_admin_settings.py --- a/rhodecode/tests/functional/test_admin_settings.py +++ b/rhodecode/tests/functional/test_admin_settings.py @@ -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 = """""" % repo.repo_id - assert opt not in response.body + response.mustcontain(no=[opt]) def test_set_fork_of_repo(self): self.log_user() diff --git a/rhodecode/tests/functional/test_followers.py b/rhodecode/tests/functional/test_followers.py --- a/rhodecode/tests/functional/test_followers.py +++ b/rhodecode/tests/functional/test_followers.py @@ -1,13 +1,24 @@ 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""") diff --git a/rhodecode/tests/functional/test_forks.py b/rhodecode/tests/functional/test_forks.py --- a/rhodecode/tests/functional/test_forks.py +++ b/rhodecode/tests/functional/test_forks.py @@ -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'] diff --git a/rhodecode/tests/functional/test_search.py b/rhodecode/tests/functional/test_search.py --- a/rhodecode/tests/functional/test_search.py +++ b/rhodecode/tests/functional/test_search.py @@ -1,6 +1,5 @@ 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()