-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV-7963: add bypassGovernance param to deleteFileVersion (#56)
- Loading branch information
Showing
3 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
core/src/test/java/com/backblaze/b2/client/structures/B2DeleteFileVersionRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2021, Backblaze Inc. All Rights Reserved. | ||
* License https://www.backblaze.com/using_b2_code.html | ||
*/ | ||
package com.backblaze.b2.client.structures; | ||
|
||
import com.backblaze.b2.json.B2Json; | ||
import com.backblaze.b2.util.B2BaseTest; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class B2DeleteFileVersionRequestTest extends B2BaseTest { | ||
|
||
@Test | ||
public void testNormal() { | ||
final B2DeleteFileVersionRequest request = | ||
B2DeleteFileVersionRequest.builder("fluffy.jpg", "4_zBlah_00000001").build(); | ||
final String requestJson = B2Json.toJsonOrThrowRuntime(request); | ||
|
||
final String expectedJson = "{\n" + | ||
" \"bypassGovernance\": false,\n" + | ||
" \"fileId\": \"4_zBlah_00000001\",\n" + | ||
" \"fileName\": \"fluffy.jpg\"\n" + | ||
"}"; | ||
|
||
assertEquals(expectedJson, requestJson); | ||
} | ||
|
||
@Test | ||
public void testWithBypassGovernanceTrue() { | ||
final B2DeleteFileVersionRequest request = B2DeleteFileVersionRequest | ||
.builder("fluffy.jpg", "4_zBlah_00000001") | ||
.setBypassGovernance(true) | ||
.build(); | ||
final String requestJson = B2Json.toJsonOrThrowRuntime(request); | ||
|
||
final String expectedJson = "{\n" + | ||
" \"bypassGovernance\": true,\n" + | ||
" \"fileId\": \"4_zBlah_00000001\",\n" + | ||
" \"fileName\": \"fluffy.jpg\"\n" + | ||
"}"; | ||
|
||
assertEquals(expectedJson, requestJson); | ||
} | ||
|
||
@Test | ||
public void testWithBypassGovernanceFalse() { | ||
final B2DeleteFileVersionRequest request = B2DeleteFileVersionRequest | ||
.builder("fluffy.jpg", "4_zBlah_00000001") | ||
.setBypassGovernance(false) | ||
.build(); | ||
final String requestJson = B2Json.toJsonOrThrowRuntime(request); | ||
|
||
final String expectedJson = "{\n" + | ||
" \"bypassGovernance\": false,\n" + | ||
" \"fileId\": \"4_zBlah_00000001\",\n" + | ||
" \"fileName\": \"fluffy.jpg\"\n" + | ||
"}"; | ||
|
||
assertEquals(expectedJson, requestJson); | ||
} | ||
} |