def test_parse_msg_parses_single_line_msg(self, mock_md5):
        mock_md5.return_value = "10"
        result = parse_msg(MESSAGE_SINGLE_LINE)

        self.assertEqual(datetime(2015, 3, 5, 21, 4, 3), result['timestamp'])
        self.assertEqual("Some Dude", result['username'])
        self.assertEqual("MSG", result['message'])
        self.assertEqual(MESSAGE_SINGLE_LINE, result['line'])
        self.assertEqual("10", result['hash'])
    def test_parse_msg_parses_multi_line_msg(self, mock_md5):
        mock_md5.return_value = "10"
        result = parse_msg(MESSAGE_MULTI_LINE)

        self.assertEqual(datetime(2015, 3, 5, 21, 4, 3), result['timestamp'])
        self.assertEqual("Some Dude", result['username'])
        self.assertEqual("MSG\nON NEXT LINE\nANOTHER LINE", result['message'])
        self.assertEqual(MESSAGE_MULTI_LINE, result['line'])
        self.assertEqual("10", result['hash'])
    def test_parse_calls_md5_with_proper_msg(self, mock_md5):
        line = "[ 2015.03.05 21:04:03 ] Some Dude > MSG\nON NEXT LINE\nANOTHER LINE"

        parse_msg(line)

        mock_md5.assert_called_with("MSG\nON NEXT LINE\nANOTHER LINE")
 def test_parse_msg_returns_non_on_invalid_msg(self):
     result = parse_msg("asdfasdf asldkfj alksdfj ;alskdfj")
     self.assertIsNone(result)