Esempio n. 1
0
    def test_restore_versions(self, mocker):
        mocker.return_value = MOCK_RESPONSE

        public_ids = ["pub1", "pub2"]
        versions = ["ver1", "ver2"]

        api.restore(public_ids, versions=versions)

        json_body = get_json_body(mocker)

        self.assertListEqual(public_ids, json_body["public_ids"])
        self.assertListEqual(versions, json_body["versions"])
Esempio n. 2
0
 def test_restore(self):
     """ should support restoring resources """
     uploader.upload(TEST_IMAGE, public_id=RESTORE_TEST_ID, backup=True, tags=[UNIQUE_API_TAG])
     resource = api.resource(RESTORE_TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
     api.delete_resources([RESTORE_TEST_ID])
     resource = api.resource(RESTORE_TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 0)
     self.assertIs(resource["placeholder"], True)
     response = api.restore([RESTORE_TEST_ID])
     info = response[RESTORE_TEST_ID]
     self.assertNotEqual(info, None)
     self.assertEqual(info["bytes"], 3381)
     resource = api.resource(RESTORE_TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
Esempio n. 3
0
 def test_restore(self):
     """ should support restoring resources """
     uploader.upload("tests/logo.png", public_id="api_test_restore", backup=True)
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
     api.delete_resources(["api_test_restore"])
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 0)
     self.assertIs(resource["placeholder"], True)
     response = api.restore(["api_test_restore"])
     info = response["api_test_restore"]
     self.assertNotEqual(info, None)
     self.assertEqual(info["bytes"], 3381)
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
Esempio n. 4
0
 def test_restore(self):
     """ should support restoring resources """
     uploader.upload("tests/logo.png", public_id="api_test_restore", backup=True)
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
     api.delete_resources(["api_test_restore"])
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 0)
     self.assertIs(resource["placeholder"], True)
     response = api.restore(["api_test_restore"])
     info = response["api_test_restore"]
     self.assertNotEqual(info, None)
     self.assertEqual(info["bytes"], 3381)
     resource = api.resource("api_test_restore")
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
Esempio n. 5
0
 def test_restore(self):
     """ should support restoring resources """
     TEST_ID = "api_test_restore_{}".format(SUFFIX)
     uploader.upload("tests/logo.png",
                     public_id=TEST_ID,
                     backup=True,
                     tags=[UNIQUE_TAG])
     resource = api.resource(TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)
     api.delete_resources([TEST_ID])
     resource = api.resource(TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 0)
     self.assertIs(resource["placeholder"], True)
     response = api.restore([TEST_ID])
     info = response[TEST_ID]
     self.assertNotEqual(info, None)
     self.assertEqual(info["bytes"], 3381)
     resource = api.resource(TEST_ID)
     self.assertNotEqual(resource, None)
     self.assertEqual(resource["bytes"], 3381)