def test_default_customer_logo(self): self.client.force_authenticate(user=self.staff) self.assert_default_logo() with dummy_image() as image: self.assert_can_upload_image(image) self.assert_can_delete_image() self.assert_default_logo()
def create_offering_file(self, user): user = getattr(self.fixture, user) self.client.force_authenticate(user) url = factories.OfferingFileFactory.get_list_url() self.provider = factories.ServiceProviderFactory( customer=self.customer) self.offering = factories.OfferingFactory(customer=self.customer) payload = { 'name': 'offering_file_1', 'offering': factories.OfferingFactory.get_url(offering=self.offering), 'file': dummy_image(), } return self.client.post(url, payload, format='multipart')
def setUp(self): super(AttachmentCreateTest, self).setUp() self.url = factories.AttachmentFactory.get_list_url() self.file = dummy_image()
def test_user_cannot_upload_logo_for_customer_he_is_not_owner_of(self): self.client.force_authenticate(user=self.user) with dummy_image() as image: response = self.upload_image(self.url, image) self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code)
def test_customer_owner_can_upload_and_delete_customer_logo(self): self.client.force_authenticate(user=self.owner) with dummy_image() as image: self.assert_can_upload_image(image) self.assert_can_delete_image()