Skip to content

Commit

Permalink
fix: Stop using testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
bmtcril committed Mar 12, 2024
1 parent 5037cfa commit 3de190d
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

try:
from cms.djangoapps.contentstore.views.course import create_new_course_in_store
from common.djangoapps.student.helpers import do_create_account
from common.djangoapps.student.models.course_enrollment import CourseEnrollment
from openedx.core.djangoapps.user_authn.views.registration_form import AccountCreationForm
from xmodule.modulestore import ModuleStoreEnum

Check warning on line 24 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L19-L24

Added lines #L19 - L24 were not covered by tests

RUNNING_IN_PLATFORM = True
Expand Down Expand Up @@ -77,17 +79,26 @@ def __init__(self, num_users: int, username_prefix: str):

for _ in range(num_users):
user_short_name = str(uuid.uuid4())[:6]
u = User.objects.create_user(
f"instructor_{course_shortname}",
u = self.create_user(

Check warning on line 82 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L81-L82

Added lines #L81 - L82 were not covered by tests
username=f"learner_{user_short_name}",
password="aspects",
email="foo@openedx.invalid",
email=f"{user_short_name}@openedx.invalid",
is_active=True
)
self.users.append(u)
e = CourseEnrollment.get_or_create_enrollment(user=u, course_key=self.course.id)
e.is_active = True
e.save()

Check warning on line 91 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L88-L91

Added lines #L88 - L91 were not covered by tests

def create_user(self, **user_data):
account_creation_form = AccountCreationForm(

Check warning on line 94 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L93-L94

Added lines #L93 - L94 were not covered by tests
data=user_data,
tos_required=False
)

(user, _, _) = do_create_account(account_creation_form)
return user

Check warning on line 100 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L99-L100

Added lines #L99 - L100 were not covered by tests

def trigger_events(

Check warning on line 102 in platform_plugin_aspects/management/commands/load_test_tracking_events.py

View check run for this annotation

Codecov / codecov/patch

platform_plugin_aspects/management/commands/load_test_tracking_events.py#L102

Added line #L102 was not covered by tests
self,
num_events: int,
Expand Down

0 comments on commit 3de190d

Please sign in to comment.