def test_enrolled_students_features_username(self): self.assertIn('username', AVAILABLE_FEATURES) userreports = enrolled_students_features(self.course_key, ['username']) self.assertEqual(len(userreports), len(self.users)) for userreport in userreports: self.assertEqual(userreport.keys(), ['username']) self.assertIn(userreport['username'], [user.username for user in self.users])
def test_enrolled_students_features_keys(self): query_features = ('username', 'name', 'email') for feature in query_features: self.assertIn(feature, AVAILABLE_FEATURES) userreports = enrolled_students_features(self.course_key, query_features) self.assertEqual(len(userreports), len(self.users)) for userreport in userreports: self.assertEqual(set(userreport.keys()), set(query_features)) self.assertIn(userreport['username'], [user.username for user in self.users]) self.assertIn(userreport['email'], [user.email for user in self.users]) self.assertIn(userreport['name'], [user.profile.name for user in self.users])