示例#1
0
    def setUp(self):
        self.login()
        self.client1 = create_client()
        self.client2 = create_client(name='Andre', email='*****@*****.**')

        # Creating data to client 1
        self.item1 = create_item(client=self.client1)
        self.picture1 = create_picture(self.item1)
        self.picture2 = create_picture(self.item1)

        # Creating data to client 2
        self.item2 = create_item(client=self.client2)
        self.picture3 = create_picture(self.item2)
        self.picture4 = create_picture(self.item2)

        # Before post must have:
        # 2 clients,
        # 2 items
        # 4 pictures
        self.assertEqual(len(ModelClient.objects.all()), 2)
        self.assertEqual(len(Item.objects.all()), 2)
        self.assertEqual(len(Picture.objects.all()), 4)

        self.response = self.client.post(
            reverse('client:delete', args=[self.client1.pk]), follow=True
        )
示例#2
0
    def setUp(self):
        self.login()
        self.client1 = create_client()

        # creating items to the client
        self.item1 = create_item(client=self.client1)
        self.item2 = create_item(
            client=self.client1, name='Chair'
        )
        self.item3 = create_item(
            client=self.client1, name='Table'
        )

        self.url = reverse('client:list_items', args=[self.client1.pk])
        self.response = self.client.get(self.url)