Merge pull request #18777 from edx/jeskew/fix_for_failing_unit_tests

Use updated name of test helper method to fix unit tests.
This commit is contained in:
Jeremy Bowman
2018-08-13 15:33:16 -04:00
committed by GitHub

View File

@@ -8,7 +8,9 @@ from django.conf import settings
from django.core.management import call_command
from user_util.user_util import get_retired_username
from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import RetirementTestCase, fake_retirement
from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import (
setup_retirement_states, fake_completed_retirement
)
from openedx.core.djangoapps.user_api.models import UserRetirementStatus
from openedx.core.djangolib.testing.utils import skip_unless_lms
from student.tests.factories import UserFactory
@@ -39,7 +41,7 @@ def _setup_users():
retirements[user.id] = retirement
if i in user_indexes_to_be_fake_retired:
fake_retirement(user)
fake_completed_retirement(user)
if i in user_indexes_to_be_rehashed:
# In order to need a rehash user.username must be the same as
@@ -58,12 +60,12 @@ def _setup_users():
@skip_unless_lms
@pytest.mark.usefixtures("setup_retirement_states")
@patch('lms.lib.comment_client.User.retire')
def test_successful_rehash(retire_user_forums, capsys):
"""
Run the command with users of all different hash statuses, expect success
"""
RetirementTestCase.setup_states()
users_skipped, users_faked, users_needing_rehash, retirements = _setup_users()
call_command('bulk_rehash_retired_usernames')
@@ -98,12 +100,12 @@ def test_successful_rehash(retire_user_forums, capsys):
@skip_unless_lms
@pytest.mark.usefixtures("setup_retirement_states")
@patch('lms.lib.comment_client.User.retire')
def test_forums_failed(retire_user_forums, capsys):
"""
Run the command with users of all different hash statuses, expect success
"""
RetirementTestCase.setup_states()
users_skipped, users_faked, users_needing_rehash, retirements = _setup_users()
retire_user_forums.side_effect = Exception('something bad happened with forums')