Exemple #1
0
    def test_upload_mapping(self):
        TEST_ID = "api_test_upload_mapping_{}".format(SUFFIX)

        api.create_upload_mapping(TEST_ID,
                                  template="http://cloudinary.com",
                                  tags=[UNIQUE_TAG])
        result = api.upload_mapping(TEST_ID)
        self.assertEqual(result["template"], "http://cloudinary.com")
        api.update_upload_mapping(TEST_ID,
                                  template="http://res.cloudinary.com")
        result = api.upload_mapping(TEST_ID)
        self.assertEqual(result["template"], "http://res.cloudinary.com")
        result = api.upload_mappings()
        self.assertIn(
            {
                "folder": TEST_ID,
                "template": "http://res.cloudinary.com"
            }, result["mappings"])
        api.delete_upload_mapping(TEST_ID)
        result = api.upload_mappings()
        self.assertNotIn(
            TEST_ID, [mapping.get("folder") for mapping in result["mappings"]])

        try:
            api.delete_upload_mapping(TEST_ID)
        except Exception:
            pass
Exemple #2
0
    def test_upload_mapping(self):

        api.create_upload_mapping(MAPPING_TEST_ID, template="http://cloudinary.com", tags=[UNIQUE_API_TAG])
        result = api.upload_mapping(MAPPING_TEST_ID)
        self.assertEqual(result["template"], "http://cloudinary.com")
        api.update_upload_mapping(MAPPING_TEST_ID, template="http://res.cloudinary.com")
        result = api.upload_mapping(MAPPING_TEST_ID)
        self.assertEqual(result["template"], "http://res.cloudinary.com")
        result = api.upload_mappings()
        self.assertIn({"folder": MAPPING_TEST_ID, "template": "http://res.cloudinary.com"},
                      result["mappings"])
        api.delete_upload_mapping(MAPPING_TEST_ID)
        result = api.upload_mappings()
        self.assertNotIn(MAPPING_TEST_ID, [mapping.get("folder") for mapping in result["mappings"]])
Exemple #3
0
 def test_upload_mapping(self):
     try:
         api.delete_upload_mapping("api_test_upload_mapping")
     except:
         pass
     api.create_upload_mapping("api_test_upload_mapping", template = "http://cloudinary.com")
     result = api.upload_mapping("api_test_upload_mapping")
     self.assertEqual(result["template"], "http://cloudinary.com")
     api.update_upload_mapping("api_test_upload_mapping", template = "http://res.cloudinary.com")
     result = api.upload_mapping("api_test_upload_mapping")
     self.assertEqual(result["template"], "http://res.cloudinary.com")
     result = api.upload_mappings()
     self.assertIn({"folder": "api_test_upload_mapping", "template": "http://res.cloudinary.com"}, result["mappings"])
     api.delete_upload_mapping("api_test_upload_mapping")
     result = api.upload_mappings()
     self.assertNotIn("api_test_upload_mapping", [mapping.get("folder") for mapping in result["mappings"]])