Skip to content

Commit b7b59e8

Browse files
committed
Better cleanup of resources in publish tests
1 parent 22dc8fa commit b7b59e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractApiTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public static void tearDownClass() {
6565
api.deleteResources(Arrays.asList(API_TEST, API_TEST_1, API_TEST_2, API_TEST_3, API_TEST_5), ObjectUtils.emptyMap());
6666
} catch (Exception ignored) {
6767
}
68+
try {
69+
api.deleteResourcesByTag(uniqueTag, ObjectUtils.emptyMap());
70+
} catch (Exception ignored) {
71+
}
6872
try {
6973
api.deleteTransformation(API_TEST_TRANSFORMATION, ObjectUtils.emptyMap());
7074
} catch (Exception ignored) {
@@ -700,7 +704,7 @@ public void testUploadMapping() throws Exception {
700704

701705
@Test
702706
public void testPublishByIds() throws Exception {
703-
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", SDK_TEST_TAG, "type", "authenticated"));
707+
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", uniqueTag, "type", "authenticated"));
704708
String publicId = (String) response.get("public_id");
705709
response = cloudinary.api().publishByIds(Arrays.asList(publicId), null);
706710
List published = (List) response.get("published");
@@ -714,7 +718,7 @@ public void testPublishByIds() throws Exception {
714718

715719
@Test
716720
public void testPublishByPrefix() throws Exception {
717-
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", SDK_TEST_TAG, "type", "authenticated"));
721+
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", uniqueTag, "type", "authenticated"));
718722
String publicId = (String) response.get("public_id");
719723
response = cloudinary.api().publishByPrefix(publicId.substring(0, publicId.length() - 2), null);
720724
List published = (List) response.get("published");
@@ -728,9 +732,9 @@ public void testPublishByPrefix() throws Exception {
728732

729733
@Test
730734
public void testPublishByTag() throws Exception {
731-
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", Arrays.asList(SDK_TEST_TAG, SDK_TEST_TAG + "1"), "type", "authenticated"));
735+
Map response = cloudinary.uploader().upload(SRC_TEST_IMAGE, ObjectUtils.asMap("tags", Arrays.asList(uniqueTag, uniqueTag + "1"), "type", "authenticated"));
732736
String publicId = (String) response.get("public_id");
733-
response = cloudinary.api().publishByTag(SDK_TEST_TAG + "1", null);
737+
response = cloudinary.api().publishByTag(uniqueTag + "1", null);
734738
List published = (List) response.get("published");
735739
assertNotNull(published);
736740
assertEquals(published.size(), 1);

0 commit comments

Comments
 (0)