forked from openedx-unsupported/edx-analytics-data-api
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to generate_fake_course_data command (openedx-unsupported#330)
Upgrade tqdm https://openedx.atlassian.net/browse/BOM-1359 This package is only used in the generate_fake_course_data which currently is not being tested, I added a test to check that everything is working as expected.
- Loading branch information
morenol
authored
Apr 14, 2020
1 parent
86a5ada
commit de1c84b
Showing
8 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
analytics_data_api/management/commands/tests/test_generate_fake_course_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
from django.core.management import call_command | ||
from django.test import TestCase | ||
|
||
from analytics_data_api.v0 import models | ||
|
||
|
||
class GenerateFakeCourseDataTests(TestCase): | ||
def testNormalRun(self): | ||
num_weeks = 2 | ||
course_id = "edX/DemoX/Demo_Course" | ||
|
||
call_command( | ||
'generate_fake_course_data', | ||
"--num-weeks={weeks}".format(weeks=num_weeks), | ||
"--no-videos", | ||
"--course-id", course_id | ||
) | ||
|
||
for model in [models.CourseEnrollmentDaily, | ||
models.CourseEnrollmentModeDaily, | ||
models.CourseEnrollmentByGender, | ||
models.CourseEnrollmentByEducation, | ||
models.CourseEnrollmentByBirthYear, | ||
models.CourseEnrollmentByCountry, | ||
models.CourseMetaSummaryEnrollment, | ||
models.CourseProgramMetadata]: | ||
self.assertTrue(model.objects.filter(course_id=course_id, ).exists()) | ||
self.assertEqual(model.objects.filter(course_id=course_id).count(), model.objects.all().count()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters