コード例 #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/'))
コード例 #2
0
ファイル: api_test.py プロジェクト: Shelvak/kegbot-server
    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/'))
コード例 #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/"))
コード例 #4
0
ファイル: models_test.py プロジェクト: dotsam/kegbot-server
    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))
コード例 #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))