[PATCH 1 of 7] tests: remove hardcoded test_admin username
Thomas De Schampheleire
patrickdepinguin at gmail.com
Sat Jun 20 16:37:54 EDT 2015
# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1434829259 -7200
# Sat Jun 20 21:40:59 2015 +0200
# Node ID af8e9af347d94a8b996d9c649a4267d585dc3745
# Parent a7ac467edbf5b71b4198f3e0e6b543c3fbb8cc47
tests: remove hardcoded test_admin username
diff --git a/kallithea/tests/functional/test_admin_gists.py b/kallithea/tests/functional/test_admin_gists.py
--- a/kallithea/tests/functional/test_admin_gists.py
+++ b/kallithea/tests/functional/test_admin_gists.py
@@ -154,7 +154,7 @@ class TestGistsController(TestController
gist = _create_gist('gist-show-me')
response = self.app.get(url('gist', gist_id=gist.gist_access_id))
response.mustcontain('added file: gist-show-me<')
- response.mustcontain('test_admin - created')
+ response.mustcontain('%s - created' % TEST_USER_ADMIN_LOGIN)
response.mustcontain('gist-desc')
response.mustcontain('<div class="btn btn-mini btn-success disabled">Public Gist</div>')
diff --git a/kallithea/tests/functional/test_changeset_comments.py b/kallithea/tests/functional/test_changeset_comments.py
--- a/kallithea/tests/functional/test_changeset_comments.py
+++ b/kallithea/tests/functional/test_changeset_comments.py
@@ -127,7 +127,7 @@ class TestChangeSetCommentsController(Te
users = [x.user.username for x in UserNotification.query().all()]
# test_regular gets notification by @mention
- self.assertEqual(sorted(users), [u'test_admin', u'test_regular'])
+ self.assertEqual(sorted(users), [TEST_USER_ADMIN_LOGIN, u'test_regular'])
def test_delete(self):
self.log_user()
diff --git a/kallithea/tests/functional/test_followers.py b/kallithea/tests/functional/test_followers.py
--- a/kallithea/tests/functional/test_followers.py
+++ b/kallithea/tests/functional/test_followers.py
@@ -10,7 +10,7 @@ class TestFollowersController(TestContro
action='followers',
repo_name=repo_name))
- response.mustcontain("""test_admin""")
+ response.mustcontain(TEST_USER_ADMIN_LOGIN)
response.mustcontain("""Started following""")
def test_index_git(self):
@@ -20,5 +20,5 @@ class TestFollowersController(TestContro
action='followers',
repo_name=repo_name))
- response.mustcontain("""test_admin""")
+ response.mustcontain(TEST_USER_ADMIN_LOGIN)
response.mustcontain("""Started following""")
diff --git a/kallithea/tests/functional/test_journal.py b/kallithea/tests/functional/test_journal.py
--- a/kallithea/tests/functional/test_journal.py
+++ b/kallithea/tests/functional/test_journal.py
@@ -12,7 +12,7 @@ class TestJournalController(TestControll
def test_stop_following_repository(self):
session = self.log_user()
-# usr = Session().query(User).filter(User.username == 'test_admin').one()
+# usr = Session().query(User).filter(User.username == TEST_USER_ADMIN_LOGIN).one()
# repo = Session().query(Repository).filter(Repository.repo_name == HG_REPO).one()
#
# followings = Session().query(UserFollowing)\
diff --git a/kallithea/tests/functional/test_login.py b/kallithea/tests/functional/test_login.py
--- a/kallithea/tests/functional/test_login.py
+++ b/kallithea/tests/functional/test_login.py
@@ -30,11 +30,11 @@ class TestLoginController(TestController
def test_login_admin_ok(self):
response = self.app.post(url(controller='login', action='index'),
- {'username': 'test_admin',
+ {'username': TEST_USER_ADMIN_LOGIN,
'password': 'test12'})
self.assertEqual(response.status, '302 Found')
self.assertEqual(response.session['authuser'].get('username'),
- 'test_admin')
+ TEST_USER_ADMIN_LOGIN)
response = response.follow()
response.mustcontain('/%s' % HG_REPO)
@@ -53,7 +53,7 @@ class TestLoginController(TestController
test_came_from = '/_admin/users'
response = self.app.post(url(controller='login', action='index',
came_from=test_came_from),
- {'username': 'test_admin',
+ {'username': TEST_USER_ADMIN_LOGIN,
'password': 'test12'})
self.assertEqual(response.status, '302 Found')
response = response.follow()
@@ -87,7 +87,7 @@ class TestLoginController(TestController
def test_login_bad_came_froms(self, url_came_from):
response = self.app.post(url(controller='login', action='index',
came_from=url_came_from),
- {'username': 'test_admin',
+ {'username': TEST_USER_ADMIN_LOGIN,
'password': 'test12'})
self.assertEqual(response.status, '302 Found')
self.assertEqual(response._environ['paste.testing_variables']
@@ -98,7 +98,7 @@ class TestLoginController(TestController
def test_login_short_password(self):
response = self.app.post(url(controller='login', action='index'),
- {'username': 'test_admin',
+ {'username': TEST_USER_ADMIN_LOGIN,
'password': 'as'})
self.assertEqual(response.status, '200 OK')
@@ -149,7 +149,7 @@ class TestLoginController(TestController
response = self.app.post(url(controller='login', action='index',
came_from = '/_admin/users',
**args),
- {'username': 'test_admin',
+ {'username': TEST_USER_ADMIN_LOGIN,
'password': 'test12'})
self.assertEqual(response.status, '302 Found')
for encoded in args_encoded:
@@ -180,7 +180,7 @@ class TestLoginController(TestController
response.mustcontain('Sign Up')
def test_register_err_same_username(self):
- uname = 'test_admin'
+ uname = TEST_USER_ADMIN_LOGIN
response = self.app.post(url(controller='login', action='register'),
{'username': uname,
'password': 'test12',
@@ -244,7 +244,7 @@ class TestLoginController(TestController
'alphanumeric character')
def test_register_err_case_sensitive(self):
- usr = 'Test_Admin'
+ usr = TEST_USER_ADMIN_LOGIN.title()
response = self.app.post(url(controller='login', action='register'),
{'username': usr,
'password': 'test12',
diff --git a/kallithea/tests/functional/test_my_account.py b/kallithea/tests/functional/test_my_account.py
--- a/kallithea/tests/functional/test_my_account.py
+++ b/kallithea/tests/functional/test_my_account.py
@@ -23,7 +23,7 @@ class TestMyAccountController(TestContro
self.log_user()
response = self.app.get(url('my_account'))
- response.mustcontain('value="test_admin')
+ response.mustcontain('value="%s' % TEST_USER_ADMIN_LOGIN)
def test_my_account_my_repos(self):
self.log_user()
@@ -152,7 +152,7 @@ class TestMyAccountController(TestContro
new_email = 'test_regular at mail.com' # already exisitn email
response = self.app.post(url('my_account'),
params=dict(
- username='test_admin',
+ username=TEST_USER_ADMIN_LOGIN,
new_password='test12',
password_confirmation='test122',
firstname='NewName',
@@ -169,7 +169,7 @@ class TestMyAccountController(TestContro
new_email = 'newmail.pl'
response = self.app.post(url('my_account'),
params=dict(
- username='test_admin',
+ username=TEST_USER_ADMIN_LOGIN,
new_password='test12',
password_confirmation='test122',
firstname='NewName',
@@ -181,7 +181,7 @@ class TestMyAccountController(TestContro
from kallithea.model import validators
msg = validators.ValidUsername(edit=False, old_data={})\
._messages['username_exists']
- msg = h.html_escape(msg % {'username': 'test_admin'})
+ msg = h.html_escape(msg % {'username': TEST_USER_ADMIN_LOGIN})
response.mustcontain(u"%s" % msg)
def test_my_account_api_keys(self):
diff --git a/kallithea/tests/functional/test_summary.py b/kallithea/tests/functional/test_summary.py
--- a/kallithea/tests/functional/test_summary.py
+++ b/kallithea/tests/functional/test_summary.py
@@ -41,8 +41,8 @@ class TestSummaryController(TestControll
)
# clone url...
- response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO)
- response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
+ response.mustcontain('''id="clone_url" readonly="readonly" value="http://%s@localhost:80/%s"''' % (TEST_USER_ADMIN_LOGIN, HG_REPO))
+ response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://%s@localhost:80/_%s"''' % (TEST_USER_ADMIN_LOGIN, ID))
def test_index_git(self):
self.log_user()
@@ -61,8 +61,8 @@ class TestSummaryController(TestControll
)
# clone url...
- response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO)
- response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID)
+ response.mustcontain('''id="clone_url" readonly="readonly" value="http://%s@localhost:80/%s"''' % (TEST_USER_ADMIN_LOGIN, GIT_REPO))
+ response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://%s@localhost:80/_%s"''' % (TEST_USER_ADMIN_LOGIN, ID))
def test_index_by_id_hg(self):
self.log_user()
diff --git a/kallithea/tests/scripts/manual_test_concurrency.py b/kallithea/tests/scripts/manual_test_concurrency.py
--- a/kallithea/tests/scripts/manual_test_concurrency.py
+++ b/kallithea/tests/scripts/manual_test_concurrency.py
@@ -54,7 +54,7 @@ load_environment(conf.global_conf, conf.
add_cache(conf)
-USER = 'test_admin'
+USER = TEST_USER_ADMIN_LOGIN
PASS = 'test12'
HOST = 'server.local'
METHOD = 'pull'
More information about the kallithea-general
mailing list