コード例 #1
0
ファイル: tests.py プロジェクト: sajanjoseph/pomodoro
 def test_slug_generated(self):
     catname="PROGRAMMING PYTHON"
     cat=PomCategory(name=catname ,description='programming lessons')
     cat.save()
     result=cat.slug
     expectedvalue=slugify(catname)
     self.assertEqual(expectedvalue,result)
コード例 #2
0
ファイル: tests.py プロジェクト: sajanjoseph/pomodoro
 def test_duration_for_categories_in_entry(self):
     category1=PomCategory(name='magic',description='magical')
     category1.save()
     category2=PomCategory(name='astronomy',description='stars,planets')
     category2.save()
     dummy=User.objects.get(id=1)
     entry1=PomEntry(today=date(2010,2,18),start_time=time(1,0,0),end_time=time(1,30,0),description='testentry1',author= dummy)
     entry1.save()       
     entry1.categories=[category1,category2]
     entry1.save()
     entry2=PomEntry(today=date(2010,2,18),start_time=time(1,10,0),end_time=time(1,30,0),description='testentry2',author= dummy)
     entry2.save()
     entry2.categories=[category1]
     entry2.save()
     entryset=[entry1,entry2]
     result_duration_dict=get_duration_for_categories(entryset)
     expected={u'astronomy': 30,u'magic': 50}      
     self.assertEqual(expected,result_duration_dict)