@@ -36,7 +36,7 @@ def create_model(self, model_id, **kwargs):
3636 start_time = datetime .datetime (2016 , 10 , 11 , tzinfo = pytz .utc ),
3737 end_time = datetime .datetime (2016 , 12 , 18 , tzinfo = pytz .utc ),
3838 pacing_type = 'instructor' , availability = kwargs ['availability' ], enrollment_mode = mode ,
39- count = 5 , cumulative_count = 10 , count_change_7_days = 1 , create = self .now ,)
39+ count = 5 , cumulative_count = 10 , count_change_7_days = 1 , passing_users = 1 , create = self .now ,)
4040 if 'programs' in kwargs and kwargs ['programs' ]:
4141 # Create a link from this course to a program
4242 G (models .CourseProgramMetadata , course_id = model_id , program_id = CourseSamples .program_ids [0 ],
@@ -70,20 +70,23 @@ def expected_result(self, item_id, modes=None, availability='Current', programs=
7070 ('count' , count_factor * num_modes ),
7171 ('cumulative_count' , cumulative_count_factor * num_modes ),
7272 ('count_change_7_days' , count_change_factor * num_modes ),
73+ ('passing_users' , count_change_factor * num_modes ),
7374 ('enrollment_modes' , {}),
7475 ])
7576 summary ['enrollment_modes' ].update ({
7677 mode : {
7778 'count' : count_factor ,
7879 'cumulative_count' : cumulative_count_factor ,
7980 'count_change_7_days' : count_change_factor ,
81+ 'passing_users' : count_change_factor ,
8082 } for mode in modes
8183 })
8284 summary ['enrollment_modes' ].update ({
8385 mode : {
8486 'count' : 0 ,
8587 'cumulative_count' : 0 ,
8688 'count_change_7_days' : 0 ,
89+ 'passing_users' : 0 ,
8790 } for mode in set (enrollment_modes .ALL ) - set (modes )
8891 })
8992 no_prof = summary ['enrollment_modes' ].pop (enrollment_modes .PROFESSIONAL_NO_ID )
@@ -92,6 +95,7 @@ def expected_result(self, item_id, modes=None, availability='Current', programs=
9295 'count' : prof ['count' ] + no_prof ['count' ],
9396 'cumulative_count' : prof ['cumulative_count' ] + no_prof ['cumulative_count' ],
9497 'count_change_7_days' : prof ['count_change_7_days' ] + no_prof ['count_change_7_days' ],
98+ 'passing_users' : prof ['passing_users' ] + no_prof ['passing_users' ],
9599 })
96100 if programs :
97101 summary ['programs' ] = [CourseSamples .program_ids [0 ]]
@@ -159,3 +163,10 @@ def test_programs(self):
159163 response = self .authenticated_get (self .path (exclude = self .always_exclude [:1 ], programs = ['True' ]))
160164 self .assertEquals (response .status_code , 200 )
161165 self .assertItemsEqual (response .data , self .all_expected_results (programs = True ))
166+
167+ @ddt .data ('passing_users' , )
168+ def test_exclude (self , field ):
169+ self .generate_data ()
170+ response = self .authenticated_get (self .path (exclude = [field ]))
171+ self .assertEquals (response .status_code , 200 )
172+ self .assertEquals (str (response .data ).count (field ), 0 )
0 commit comments