Exemplo n.º 1
0
    def test_with_prefetch_related_content(self):
        ilf = IncomingLetterFactory()
        ipp = IncomingParcelPostFactory()
        ipp2 = IncomingParcelPostFactory()
        ipp3 = IncomingParcelPostFactory()

        with self.assertNumQueries(num=4):
            objects = list(
                Record.objects.with_prefetch_related_content().all())
            self.assertEquals(objects[0].content_object, ilf)
            self.assertEquals(objects[1].content_object, ipp)
            self.assertEquals(objects[2].content_object, ipp2)
            self.assertEquals(objects[3].content_object, ipp3)
Exemplo n.º 2
0
 def test_display_parcel(self):
     ipp = IncomingParcelPostFactory(
         record__case__monitoring=self.monitoring)
     opp = OutgoingParcelPostFactory(
         record__case__monitoring=self.monitoring)
     response = self.client.get(self.get_url())
     self.assertContains(response, ipp)
     self.assertContains(response, opp)
Exemplo n.º 3
0
 def test_for_milestone_returns_parcels(self):
     qs = Record.objects.for_milestone()
     self.assertTrue(
         qs.filter(parcels_incomingparcelposts=IncomingParcelPostFactory()).
         exists())
     self.assertTrue(
         qs.filter(parcels_outgoingparcelposts=OutgoingParcelPostFactory()).
         exists())
Exemplo n.º 4
0
 def test_show_parce_post(self):
     parcel = IncomingParcelPostFactory(record__case=self.case)
     response = self.client.get(self.get_url())
     self.assertContains(response, parcel.title)
Exemplo n.º 5
0
 def setUp(self):
     super().setUp()
     self.object = IncomingParcelPostFactory(record__case=self.case)
Exemplo n.º 6
0
 def test_serialization_of_incomingparcel(self):
     parcel = IncomingParcelPostFactory()
     result = RecordSerializer(instance=parcel.record,
                               context=self.context).data
     self.assertEqual(result["content_object"]["title"], parcel.title)
Exemplo n.º 7
0
 def test_basic_create(self):
     IncomingParcelPostFactory()