Skip to content

Commit 3102f2a

Browse files
Test hasSecurity method with Kotlin
1 parent f3858b2 commit 3102f2a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.filestack
2+
3+
import org.junit.Assert
4+
import org.junit.Assert.*
5+
import org.junit.Test
6+
7+
class ConfigTest {
8+
9+
@Test
10+
fun `verifies security`() {
11+
var config = Config("api_key")
12+
assertFalse(config.hasSecurity())
13+
14+
config = Config("api_key", "return_url", "policy", null)
15+
assertFalse(config.hasSecurity())
16+
17+
config = Config("api_key", "return_url", null, "policy")
18+
assertFalse(config.hasSecurity())
19+
20+
config = Config("api_key", "return_url", "policy", "signature")
21+
assertTrue(config.hasSecurity())
22+
23+
val policy = Policy.Builder()
24+
.giveFullAccess()
25+
.build("api_key")
26+
27+
config = Config("api_key", policy)
28+
assertTrue(config.hasSecurity())
29+
}
30+
31+
}

0 commit comments

Comments
 (0)