def test_question_user_followers_no_followers(self): """ question_user_followers() should return None if the user has no followers. """ u = UserData(None) u._personal_data = {'followers': {'total': 0}} quiz = Quiz.objects.create(user_id='Cassius') question = question_user_followers(quiz, u) self.assertIsNone(question)
def test_question_user_followers_no_negative_options(self): """ question_user_followers() should return a question with a non-negative minimum range value. """ u = UserData(None) u._personal_data = {'followers': {'total': 1}} quiz = Quiz.objects.create(user_id='Cassius') question = question_user_followers(quiz, u) self.assertEqual(question.slider_min, 0) self.assertLessEqual(question.slider_max, 11) self.assertEqual(question.answer, 1)
def test_question_user_followers(self): """ question_user_followers() creates a slider question asking how many followers the user has. """ u = UserData(None) u._personal_data = {'followers': {'total': 8}} quiz = Quiz.objects.create(user_id='Cassius') question = question_user_followers(quiz, u) self.assertGreaterEqual(question.slider_min, 0) self.assertLessEqual(question.slider_max, 18) self.assertEqual(question.answer, 8)