def test_store_should_return_result_meta_with_location(self):
     self.assertEqual('https://bucket.s3-region.amazonaws.com/some/location',
         Source.from_buffer('png file').store(service='s3').location)
Example #2
0
 def test_from_buffer_should_return_source(self):
     self.assertIsInstance(Source.from_buffer('png file'), Source)
 def test_preserve_should_include_other_options_if_set(self):
     self.assertEqual(b'copyrighted file', Source.from_buffer('png file').resize(width=400).preserve("copyright", "location").to_buffer())
     self.assertJsonEqual('{"preserve":["copyright","location"],"resize":{"width":400}}', httpretty.last_request().body.decode('utf-8'))
Example #4
0
 def test_store_should_return_result_meta_with_location(self):
     self.assertEqual(
         'https://bucket.s3-region.amazonaws.com/some/location',
         Source.from_buffer('png file').store(service='s3').location)
Example #5
0
 def test_to_file_with_file_object_should_store_image_data(self):
     with tempfile.NamedTemporaryFile() as tmp:
         Source.from_buffer('png file').to_file(tmp.name)
         self.assertEqual(b'compressed file', tmp.read())
Example #6
0
 def test_result_should_return_result(self):
     self.assertIsInstance(Source.from_buffer('png file').result(), Result)
Example #7
0
 def test_resize_should_return_source_with_data(self):
     self.assertEqual(
         b'small file',
         Source.from_buffer('png file').resize(width=400).to_buffer())
 def test_preserve_should_return_source(self):
     self.assertIsInstance(Source.from_buffer('png file').preserve("copyright", "location"), Source)
     self.assertEqual(b'png file', httpretty.last_request().body)
 def test_to_file_with_file_object_should_store_image_data(self):
     with tempfile.NamedTemporaryFile() as tmp:
         Source.from_buffer('png file').to_file(tmp.name)
         self.assertEqual(b'compressed file', tmp.read())
 def test_store_should_return_result_meta_with_location(self):
     self.assertEqual('https://bucket.s3-region.amazonaws.com/some/location',
         Source.from_buffer('png file').store(service='s3').location)
     self.assertJsonEqual('{"store":{"service":"s3"}}', httpretty.last_request().body.decode('utf-8'))
 def test_store_should_include_other_options_if_set(self):
     self.assertEqual('https://bucket.s3-region.amazonaws.com/some/location', Source.from_buffer('png file').resize(width=400).store(service='s3').location)
     self.assertJsonEqual('{"store":{"service":"s3"},"resize":{"width":400}}', httpretty.last_request().body.decode('utf-8'))
 def test_store_should_return_result_meta(self):
     self.assertIsInstance(Source.from_buffer('png file').store(service='s3'), ResultMeta)
     self.assertJsonEqual('{"store":{"service":"s3"}}', httpretty.last_request().body.decode('utf-8'))
 def test_resize_should_return_source_with_data(self):
     self.assertEqual(b'small file', Source.from_buffer('png file').resize(width=400).to_buffer())
     self.assertJsonEqual('{"resize":{"width":400}}', httpretty.last_request().body.decode('utf-8'))
 def test_resize_should_return_source(self):
     self.assertIsInstance(Source.from_buffer('png file').resize(width=400), Source)
     self.assertEqual(b'png file', httpretty.last_request().body)
 def test_to_buffer_should_return_image_data(self):
     self.assertEqual(b'compressed file', Source.from_buffer('png file').to_buffer())
 def test_from_buffer_should_raise_account_error(self):
     with self.assertRaises(AccountError):
         Source.from_buffer('png file')
 def test_to_file_with_path_should_store_image_data(self):
     with tempfile.TemporaryFile() as tmp:
         Source.from_buffer('png file').to_file(tmp)
         tmp.seek(0)
         self.assertEqual(b'compressed file', tmp.read())
 def test_from_buffer_should_return_source(self):
     self.assertIsInstance(Source.from_buffer('png file'), Source)
Example #19
0
 def test_resize_should_return_source(self):
     self.assertIsInstance(
         Source.from_buffer('png file').resize(width=400), Source)
 def test_result_should_return_result(self):
     self.assertIsInstance(Source.from_buffer('png file').result(), Result)
Example #21
0
 def test_store_should_return_result_meta(self):
     self.assertIsInstance(
         Source.from_buffer('png file').store(), ResultMeta)
 def test_resize_should_return_source(self):
     self.assertIsInstance(Source.from_buffer('png file').resize(width=400), Source)
Example #23
0
 def test_to_file_with_path_should_store_image_data(self):
     with tempfile.TemporaryFile() as tmp:
         Source.from_buffer('png file').to_file(tmp)
         tmp.seek(0)
         self.assertEqual(b'compressed file', tmp.read())
 def test_resize_should_return_source_with_data(self):
     self.assertEqual(b'small file', Source.from_buffer('png file').resize(width=400).to_buffer())
Example #25
0
 def test_from_buffer_should_raise_account_error(self):
     with self.assertRaises(AccountError):
         Source.from_buffer('png file')
 def test_store_should_return_result_meta(self):
     self.assertIsInstance(Source.from_buffer('png file').store(), ResultMeta)
Example #27
0
 def test_from_buffer_should_return_source_with_data(self):
     self.assertEqual(b'compressed file',
                      Source.from_buffer('png file').to_buffer())
 def test_preserve_should_return_source_with_data_for_tuple(self):
     self.assertEqual(b'copyrighted file', Source.from_buffer('png file').preserve(("copyright", "location")).to_buffer())
     self.assertJsonEqual('{"preserve":["copyright","location"]}', httpretty.last_request().body.decode('utf-8'))