aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2013-03-31 21:44:27 +0200
committerMarcin Kuzminski <marcin@python-works.com>2013-03-31 21:44:27 +0200
commitaaeac3d85e7ac49891d5cd329f47536c8c7c277a (patch)
tree28f3c4e866d57e7db2a6f7f4bfca806958f82af8
parent6e56dc0faed57a54f15a565a5e6e8aa8141e74fb (diff)
Use only mustcontain for testing response body
--HG-- branch : beta
-rw-r--r--rhodecode/tests/__init__.py2
-rw-r--r--rhodecode/tests/functional/test_admin_ldap_settings.py13
-rw-r--r--rhodecode/tests/functional/test_admin_notifications.py5
-rw-r--r--rhodecode/tests/functional/test_admin_settings.py7
-rw-r--r--rhodecode/tests/functional/test_followers.py17
-rw-r--r--rhodecode/tests/functional/test_forks.py4
-rw-r--r--rhodecode/tests/functional/test_search.py8
7 files changed, 31 insertions, 25 deletions
diff --git a/rhodecode/tests/__init__.py b/rhodecode/tests/__init__.py
index fc4cd59a..48856634 100644
--- a/rhodecode/tests/__init__.py
+++ b/rhodecode/tests/__init__.py
@@ -33,6 +33,7 @@ from paste.script.appinstall import SetupCommand
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
index 41ae6dfc..bd838c0c 100644
--- 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(TestController):
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(TestController):
'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
diff --git a/rhodecode/tests/functional/test_admin_notifications.py b/rhodecode/tests/functional/test_admin_notifications.py
index 05ead3b2..96d14a2b 100644
--- a/rhodecode/tests/functional/test_admin_notifications.py
+++ b/rhodecode/tests/functional/test_admin_notifications.py
@@ -22,8 +22,7 @@ class TestNotificationsController(TestController):
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(TestController):
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
index c7dfdfa3..165ec09b 100644
--- a/rhodecode/tests/functional/test_admin_settings.py
+++ b/rhodecode/tests/functional/test_admin_settings.py
@@ -90,8 +90,7 @@ class TestAdminSettingsController(TestController):
.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(TestController):
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(TestController):
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()
diff --git a/rhodecode/tests/functional/test_followers.py b/rhodecode/tests/functional/test_followers.py
index 09984b75..88e31930 100644
--- 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
index e6cb7b7c..d86d4ed8 100644
--- 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
index 91613388..879cf9ca 100644
--- 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(TestController):
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(TestController):
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()