Example #1
0
    def test_pictures(self):
        image_data = open(get_filename('test_image_800x600.png'))
        response, data = self.post('pictures/', data={'photo': image_data}, HTTP_X_KEGBOT_API_KEY=self.apikey.key)
        self.assertEquals(data.meta.result, 'ok')

        picture = data['object']
        picture_url = picture['url']
        self.assertTrue(picture_url.startswith('http://localhost:1234/media/'))
Example #2
0
    def test_pictures(self):
        image_data = open(get_filename('test_image_800x600.png'))
        response, data = self.post('pictures/', data={'photo': image_data}, HTTP_X_KEGBOT_API_KEY=self.apikey.key)
        self.assertEquals(data.meta.result, 'ok')

        picture = data['object']
        picture_url = picture['url']
        self.assertTrue(picture_url.startswith('http://localhost:1234/media/'))
Example #3
0
    def test_pictures(self):
        image_data = open(get_filename("test_image_800x600.png"), "rb")
        response, data = self.post("pictures/",
                                   data={"photo": image_data},
                                   HTTP_X_KEGBOT_API_KEY=self.apikey.key)
        self.assertEqual(data.meta.result, "ok")

        picture = data["object"]
        picture_url = picture["url"]
        self.assertTrue(picture_url.startswith("http://localhost:1234/media/"))
Example #4
0
    def test_photos(self):
        picture_file = File(open(get_filename('test_image_800x600.png'), 'rb'))
        picture_obj = models.Picture.objects.create(image=picture_file)

        paths = []
        for spec in ('resized', 'resized_png', 'thumbnail', 'thumbnail_png', 'image'):
            img = getattr(picture_obj, spec)
            path = img.path
            self.assertTrue(os.path.exists(path))
            paths.append(path)

        picture_obj.erase_and_delete()
        for path in paths:
            self.assertFalse(os.path.exists(path))
Example #5
0
    def test_photos(self):
        picture_file = File(open(get_filename('test_image_800x600.png'), 'rb'))
        picture_obj = models.Picture.objects.create(image=picture_file)

        paths = []
        for spec in ('resized', 'resized_png', 'thumbnail', 'thumbnail_png', 'image'):
            img = getattr(picture_obj, spec)
            path = img.path
            self.assertTrue(os.path.exists(path))
            paths.append(path)

        picture_obj.erase_and_delete()
        for path in paths:
            self.assertFalse(os.path.exists(path))