Beispiel #1
0
 def test_add_context(self):
     """should allow adding context"""
     context = {"caption": "some caption", "alt": "alternative|alt=a"}
     result = uploader.upload(TEST_IMAGE, tags=[UNIQUE_TAG])
     info = api.resource(result["public_id"], context=True)
     self.assertFalse("context" in info)
     uploader.add_context(context, result["public_id"])
     info = api.resource(result["public_id"], context=True)
     self.assertEqual({"custom": context}, info["context"])
 def test_add_context(self):
     """should allow adding context"""
     context = {"caption": "some caption", "alt": "alternative|alt=a"}
     result = uploader.upload(TEST_IMAGE, tags=[UNIQUE_TAG])
     info = api.resource(result["public_id"], context=True)
     self.assertFalse("context" in info)
     uploader.add_context(context, result["public_id"])
     info = api.resource(result["public_id"], context=True)
     self.assertEqual({"custom": context}, info["context"])