Skip to content
Permalink
Browse files Browse the repository at this point in the history
Update tests to use a stronger password
  • Loading branch information
atodorov committed Jan 1, 2023
1 parent 802ee50 commit 3759fb6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
1 change: 1 addition & 0 deletions tcms/kiwi_auth/tests/__init__.py
@@ -0,0 +1 @@
__FOR_TESTING__ = "5a5b6e17f9c34025a75b052fc06c50ab"
14 changes: 8 additions & 6 deletions tcms/kiwi_auth/tests/test_admin.py
Expand Up @@ -11,6 +11,8 @@
from tcms.tests import LoggedInTestCase, user_should_have_perm
from tcms.tests.factories import GroupFactory, UserFactory

from . import __FOR_TESTING__


class TestUserAdmin(LoggedInTestCase): # pylint: disable=too-many-public-methods
@classmethod
Expand Down Expand Up @@ -65,8 +67,8 @@ def test_superuser_can_add_users(self):
"/admin/auth/user/add/",
{
"username": "added-by-admin",
"password1": "xo-xo-xo",
"password2": "xo-xo-xo",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
},
follow=True,
)
Expand Down Expand Up @@ -225,8 +227,8 @@ def test_moderator_can_add_users(self):
"/admin/auth/user/add/",
{
"username": "added-by-moderator",
"password1": "xo-xo-xo",
"password2": "xo-xo-xo",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
},
follow=True,
)
Expand Down Expand Up @@ -373,8 +375,8 @@ def test_regular_user_cant_add_users(self):
"/admin/auth/user/add/",
{
"username": "added-by-regular-user",
"password1": "xo-xo-xo",
"password2": "xo-xo-xo",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
},
follow=True,
)
Expand Down
10 changes: 6 additions & 4 deletions tcms/kiwi_auth/tests/test_forms.py
Expand Up @@ -5,13 +5,15 @@

from tcms.kiwi_auth import forms

from . import __FOR_TESTING__


class TestCaptchaField(TestCase):
def setUp(self):
self.data = {
"username": "test_user",
"password1": "password",
"password2": "password",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
"email": "new-tester@example.com",
}

Expand Down Expand Up @@ -49,8 +51,8 @@ class TestRegistrationForm(TestCase):
def setUp(self):
self.data = {
"username": "test_user",
"password1": "password",
"password2": "password",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
"email": "new-tester@example.com",
}

Expand Down
14 changes: 8 additions & 6 deletions tcms/kiwi_auth/tests/test_views.py
Expand Up @@ -17,6 +17,8 @@
from tcms.kiwi_auth.models import UserActivationKey
from tcms.tests.factories import UserFactory

from . import __FOR_TESTING__

User = get_user_model() # pylint: disable=invalid-name


Expand Down Expand Up @@ -117,8 +119,8 @@ def assert_user_registration(self, username, follow=False):
self.register_url,
{
"username": username,
"password1": "password",
"password2": "password",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
"email": "new-tester@example.com",
"captcha_0": "PASSED",
"captcha_1": "PASSED",
Expand Down Expand Up @@ -254,8 +256,8 @@ def test_invalid_form(self):
self.register_url,
{
"username": "kiwi-tester",
"password1": "password-1",
"password2": "password-2",
"password1": __FOR_TESTING__,
"password2": f"000-{__FOR_TESTING__}",
"email": "new-tester@example.com",
},
follow=False,
Expand All @@ -272,8 +274,8 @@ def test_register_user_already_registered(self):
self.register_url,
{
"username": "test_user",
"password1": "password",
"password2": "password",
"password1": __FOR_TESTING__,
"password2": __FOR_TESTING__,
"email": "new-tester@example.com",
},
follow=False,
Expand Down

0 comments on commit 3759fb6

Please sign in to comment.