Beispiel #1
0
class FarmerDetailViewTest(TestCase):

    def setUp(self):
        self.farmer = FarmerFactory()
        self.farmer.save()

    def test_farmer_detail_uses_template(self):
        response = self.client.get('/farmer/{id}/'.format(id=self.farmer.id))
        self.assertTemplateUsed(response,'farmer_detail.html')

    def test_farmer_detail_passes_farmer(self):
        response = self.client.get('/farmer/{id}/'.format(id=self.farmer.id))
        self.assertEqual( self.farmer, response.context['farmer'] )
Beispiel #2
0
 def setUp(self):
     self.farmer = FarmerFactory.create()
     self.produce1 = ProduceFactory.create(farmer=self.farmer,
                                    collection_start=datetime(2013,3,1), collection_end=datetime(2013,3,2))
     self.produce2 = ProduceFactory.create(farmer=self.farmer,
                                    collection_start=datetime(2013,3,4), collection_end=datetime(2013,3,6))
     self.produce3 = ProduceFactory.create(farmer=self.farmer,
                                    collection_start=datetime(2013,3,20), collection_end=datetime(2013,4,1))
     self.produce4 = ProduceFactory.create()
Beispiel #3
0
 def setUp(self):
     self.farmer = FarmerFactory()
     self.farmer.save()