Example #1
0
 def testProcessLines(self):
     import pytz
     from mineline.PreProcessLog import PreProcessLog
     from mineline.Events import MessageEvent
     # Setup
     data = ("2013/05/23(Thursday)\r\n"
     "12:48\tJohn\tI think so too\r\n"
     "2013/05/25(Friday)\r\n"
     "14:25\tJohn\tHello?\r\n")
     
     PreProcessLog.saveTimeZone = pytz.timezone("US/Eastern") # Set timezone so converTime() works
     data = PreProcessLog.splitLines(data)
     data = PreProcessLog.splitTabsAndCleanBlanks(data)
     data = PreProcessLog.convertTimes(data)
     
     expectedData = [MessageEvent("John", "2013/05/23 16:48 UTC", "I think so too"),
                     MessageEvent("John", "2013/05/25 18:25 UTC", "Hello?")]
     # Exercise
     log_list, saveTime = PreProcessLog.processLines(data)
     
     # Test
     self.assertEqual(log_list, expectedData)