def test15a_transformation_unsafe_update(self): """ should allow unsafe update of named transformation """ api.create_transformation(API_TEST_TRANS3, {"crop": "scale", "width": 102}) api.update_transformation(API_TEST_TRANS3, unsafe_update={"crop": "scale", "width": 103}) transformation = api.transformation(API_TEST_TRANS3) self.assertNotEqual(transformation, None) self.assertEqual(transformation["info"], [{"crop": "scale", "width": 103}]) self.assertEqual(transformation["used"], False)
def test15_transformation_create(self, mocker): """ should allow creating named transformation """ mocker.return_value = MOCK_RESPONSE api.create_transformation(API_TEST_TRANS, {"crop": "scale", "width": 102}) args, kargs = mocker.call_args self.assertEqual(args[0], 'POST') self.assertTrue(get_uri(args).endswith('/transformations/{}'.format(API_TEST_TRANS)), get_uri(args)) self.assertEqual(get_params(args)['transformation'], 'c_scale,w_102')
def test15_transformation_create(self): """ should allow creating named transformation """ api.create_transformation("api_test_transformation", {"crop": "scale", "width": 102}) transformation = api.transformation("api_test_transformation") self.assertNotEqual(transformation, None) self.assertEqual(transformation["allowed_for_strict"], True) self.assertEqual(transformation["info"], [{"crop": "scale", "width": 102}]) self.assertEqual(transformation["used"], False)
def test16_transformation_delete(self): """ should allow deleting named transformation """ api.create_transformation(API_TEST_TRANS2, { "crop": "scale", "width": 103 }) api.transformation(API_TEST_TRANS2) api.delete_transformation(API_TEST_TRANS2) self.assertRaises(api.NotFound, api.transformation, API_TEST_TRANS2)
def test16_transformation_delete(self): """ should allow deleting named transformation """ api.create_transformation("api_test_transformation2", { "crop": "scale", "width": 103 }) api.transformation("api_test_transformation2") api.delete_transformation("api_test_transformation2") self.assertRaises(api.NotFound, api.transformation, ("api_test_transformation2"))
def test15c_transformation_create_unnamed_with_empty_format(self, mocker): """ should allow creating unnamed transformation with empty extension""" mocker.return_value = MOCK_RESPONSE with_extension = dict(API_TEST_TRANS_SCALE100) with_extension.update(format="") with_extension_str = API_TEST_TRANS_SCALE100_STR + "/" api.create_transformation(with_extension_str, with_extension) args, kargs = mocker.call_args self.assertEqual(args[0], 'POST') self.assertTrue(get_uri(args).endswith('/transformations'), get_uri(args)) self.assertEqual(with_extension_str, get_params(args)['transformation']) self.assertEqual(with_extension_str, get_params(args)['name'])
def test16_transformation_delete(self): """ should allow deleting named transformation """ api.create_transformation(API_TEST_TRANS2, {"crop": "scale", "width": 103}) api.transformation(API_TEST_TRANS2) api.delete_transformation(API_TEST_TRANS2) self.assertRaises(api.NotFound, api.transformation, API_TEST_TRANS2)
def test16_transformation_delete(self): """ should allow deleting named transformation """ api.create_transformation("api_test_transformation2", {"crop": "scale", "width": 103}) api.transformation("api_test_transformation2") api.delete_transformation("api_test_transformation2") self.assertRaises(api.NotFound, api.transformation, ("api_test_transformation2"))