class ConversionServerClientSmokeTest(unittest.TestCase):
    """Basic Conversion Server Smoke Test"""

    def setUp(self):
        self.conv = ConversionServerClient()

    def test_notype_error(self):
        """Test that missing type causes bad request error"""
        with self.assertRaises(Exception):
            self.conv.request(IMAGE_HASH, IMAGE_QUICKKEY, None)

    def test_image_resize(self):
        """Test that image resize works"""
        result = self.conv.request(IMAGE_HASH, IMAGE_QUICKKEY,
                                   'i', size_id='1')
        self.assertEquals(result.headers['content-type'], 'image/jpeg')

    def test_image_nosize_error(self):
        """Test that supplying no size causes error"""
        with self.assertRaises(ConversionServerError):
            self.conv.request(IMAGE_HASH, IMAGE_QUICKKEY, 'i')
Example #2
0
class ConversionServerClientSmokeTest(unittest.TestCase):
    """Basic Conversion Server Smoke Test"""
    def setUp(self):
        self.conv = ConversionServerClient()

    def test_notype_error(self):
        """Test that missing type causes bad request error"""
        with self.assertRaises(Exception):
            self.conv.request(IMAGE_HASH, IMAGE_QUICKKEY, None)

    def test_image_resize(self):
        """Test that image resize works"""
        result = self.conv.request(IMAGE_HASH,
                                   IMAGE_QUICKKEY,
                                   'i',
                                   size_id='1')
        self.assertEqual(result.headers['content-type'], 'image/jpeg')

    def test_image_nosize_error(self):
        """Test that supplying no size causes error"""
        with self.assertRaises(ConversionServerError):
            self.conv.request(IMAGE_HASH, IMAGE_QUICKKEY, 'i')
Example #3
0
 def setUp(self):
     self.conv = ConversionServerClient()
 def setUp(self):
     self.conv = ConversionServerClient()