def test_questioner_lets_the_chat_know_its_moving_on(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } mock_connection = Connection() s = Subject(mock_connection, question, Questions_Asked(), Player_Scores(), Timer()) s.go() self.assertTrue(mock_connection._message in Chat.unanswered_questions)
def test_questioner_includes_the_winners_name_when_they_answer_correctly_immediately(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } mock_connection = Connection() mock_connection.last_response = ("happy_lass", "OMG Han! Chewie! They're all here!") s = Subject(mock_connection, question, Questions_Asked(), Player_Scores(), Timer()) s.go() self.assertTrue(mock_connection.last_response[0] in mock_connection._message)
def test_questioner_ignores_incorect_answers_from_connection(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } mock_connection = Connection() mock_connection.last_response = ("trivvy_fan", "The Wrong Answer") s = Subject(mock_connection, question, Questions_Asked(), Player_Scores(), Timer()) s.go() self.assertTrue(mock_connection._message in Chat.unanswered_questions)
def test_questioner_does_not_record_the_player_when_they_answer_incorrectly(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } mock_connection = Connection() mock_player_scores = Player_Scores() mock_connection.last_response = ("wrong_man", "a model representing a scene with three-dimensional figures") s = Subject(mock_connection, question, Questions_Asked(), mock_player_scores, Timer()) s.go() self.assertEqual("Not Yet Called.", mock_player_scores._score)
def test_questioner_records_the_winner_when_they_answer_correctly(self): question = { 'Ask': "What's a Diorama?", 'Answer': "OMG Han! Chewie! They're all here!" } mock_connection = Connection() mock_player_scores = Player_Scores() mock_connection.last_response = ("happy_lass", "OMG Han! Chewie! They're all here!") s = Subject(mock_connection, question, Questions_Asked(), mock_player_scores, Timer()) s.go() self.assertEqual(mock_connection.last_response[0], mock_player_scores._score)
def test_questioner_has_a_strict_oder_to_its_message_flow(self): question = { 'Ask': "What also floats in water?", 'Answer': "A Duck!" } mock_connection = Connection() mock_timer = Timer() s = Subject(mock_connection, question, Questions_Asked(), Player_Scores(), Timer()) s.go() self.assertEqual(len(mock_connection._message_list), 4) self.assertEqual(s.ask, mock_connection._message_list[0]) self.assertEqual(s.first_hint(), mock_connection._message_list[1]) self.assertEqual(s.second_hint(), mock_connection._message_list[2]) self.assertTrue(mock_connection._message_list[3] in Chat.unanswered_questions)