def test3_TaskList(self): tList = task.MyTaskList() tList.append('Task 1') time.sleep(3) tList.current.stop() print tList.current.life() self.assertNotEqual(tList.current.life(), None)
def __init__(self, parent, id, title): self.maxtime = settings.MAX_TIME * 60 self.count = 0 self.taskname = '' wx.Frame.__init__(self, parent, id, title, size=(250, 170)) self.timer = wx.Timer(self, 1) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) iconFile = '%s/%s' % (os.path.dirname(img.__file__), settings.ICON) icon1 = wx.Icon(iconFile, wx.BITMAP_TYPE_ICO) self.SetIcon(icon1) panel = wx.Panel(self, -1) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox3 = wx.BoxSizer(wx.HORIZONTAL) self.gauge = wx.Gauge(panel, -1, settings.MAX_TIME * 60, size=(250, 20)) self.btn1 = wx.Button(panel, wx.ID_OK, messages.BUTTON_START) self.btn2 = wx.Button(panel, wx.ID_STOP) self.text = wx.StaticText(panel, -1, messages.TASK_TOBE_DONE) self.Bind(wx.EVT_CLOSE, self.OnExit, self) self.Bind(wx.EVT_BUTTON, self.OnOk, self.btn1) self.Bind(wx.EVT_BUTTON, self.OnStop, self.btn2) hbox1.Add(self.gauge, 1, wx.ALIGN_CENTRE) hbox2.Add(self.btn1, 1, wx.RIGHT, 10) hbox2.Add(self.btn2, 1) hbox3.Add(self.text, 1) vbox.Add((0, 10), 0) vbox.Add(hbox3, 1, wx.ALIGN_CENTRE) vbox.Add(hbox1, 0, wx.ALIGN_CENTRE) vbox.Add((0, 20), 0) vbox.Add(hbox2, 1, wx.ALIGN_CENTRE) panel.SetSizer(vbox) self.CreateStatusBar() self.Centre() self.__menu__() # Task list: self.tasklist = task.MyTaskList() self.tosave = False self.username = settings.google_calendar_account self.Show(True) # Counter self.counter = task.Counter() self.SetStatusText(messages.MSG_STAUTS_NR_TASK % self.counter.value)
def test_2_TaskCSV(self): mytaskList = task.MyTaskList() mytaskList.append('task 1') mytaskList.current.stop() mytaskList.append('task 2') mytaskList.current.stop() out = task.csvTaskFormatter(mytaskList) print out self.assertTrue(((out.find('task 1') > -1) and (out.find('task 2') > -1)))
def test4_TaskList(self): tList = task.MyTaskList() tList.append('Task 1') time.sleep(3) tList.current.stop() tList.append('', task.MyTask('Task 2')) self.assertTrue(len(tList.list), 2) time.sleep(2) tList.current.stop() for i in tList.list: sec = i.life().seconds print '%s %d' % (i.name, sec) self.assertTrue(sec > 0)
def test2_TaskEvent(self): username = settings.google_calendar_account password = raw_input('Password for %s?' % username) entry = EntryManager(username, password) my_task_list = task.MyTaskList() my_task_list.append('Google calendar') time.sleep(120) my_task_list.current.stop() tasks = my_task_list.task_to_send() for item in tasks: event = entry.insert_single_event(item.name, item._startAt.timetuple(), item._stopAt.timetuple()) self.assertFalse(event == None)
def test6_TaskName(self): mytaskList = task.MyTaskList() mytaskList.append('Task 1') self.assertEqual(mytaskList.current.name, 'Task 1')