コード例 #1
0
ファイル: tests.py プロジェクト: crystal3a/worklog
 def test_reminder_submitAndExit(self):
     uuidstr = '00001111000011110000111100001111'
     id = str(uuid.UUID(uuidstr))
     reminder = WorkLogReminder(reminder_id=id, user=self.user, date=self.last_week)
     reminder.save()
     jobs = reminder.get_available_jobs()
     job = jobs[0]
     
     with self.scoped_login(username='******', password='******'):
     
         data = {'submit_and_exit':'','hours':'2', 'text':'description', 'job':job.pk}
         response = self.client.post('/worklog/add/reminder_{0}/'.format(id), data)
         
         #datemin = self.last_week.replace(day=1)
         #datemax = get_month_end(self.last_week)
         
         redirurl = '/worklog/view/{0}/{1}_{1}/'.format(self.user.username,self.last_week)
         self.assertRedirects(response, redirurl)
         
         items = WorkItem.objects.all()
         self.assertEquals(items.count(),1)
         
         item = items[0]
         self.assertEquals(item.date, self.last_week)
         self.assertEquals(item.hours, 2)
         self.assertEquals(item.job, job)
コード例 #2
0
ファイル: tests.py プロジェクト: crystal3a/worklog
 def test_reminder_submitAndAddAnother(self):
     uuidstr = '00001111000011110000111100001111'
     id = str(uuid.UUID(uuidstr))
     reminder = WorkLogReminder(reminder_id=id, user=self.user, date=self.last_week)
     reminder.save()
     jobs = reminder.get_available_jobs()
     job = jobs[0]
     
     with self.scoped_login(username='******', password='******'):
     
         data = {'submit_and_add_another':'','hours':'4', 'text':'description', 'job':job.pk}
         response = self.client.post('/worklog/add/reminder_{0}/'.format(id), data)
         
         self.assertRedirects(response, '/worklog/add/reminder_{0}/'.format(id))
         
         items = WorkItem.objects.all()
         self.assertEquals(items.count(),1)
         
         item = items[0]
         self.assertEquals(item.date, self.last_week)
         self.assertEquals(item.hours, 4)
         self.assertEquals(item.job, job)