summaryrefslogtreecommitdiff
path: root/libs/samba/src/test/java
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2024-08-20 23:21:06 +0200
committerJoel Klinghed <the_jk@spawned.biz>2024-08-20 23:21:06 +0200
commit9b7f943969e17273ac9bd78bb238ffbea3865993 (patch)
tree32d7d5c5f35414717b8bfa25f786fc4d2ebce029 /libs/samba/src/test/java
parent088a7aef623700798647ad5b279388c4f7a59299 (diff)
Support building libsamba.so for unittests
Unittests still fail as there is no samba server to talk to (step 2).
Diffstat (limited to 'libs/samba/src/test/java')
-rw-r--r--libs/samba/src/test/java/org/the_jk/cleversync/samba/SambaTreeTest.kt39
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/samba/src/test/java/org/the_jk/cleversync/samba/SambaTreeTest.kt b/libs/samba/src/test/java/org/the_jk/cleversync/samba/SambaTreeTest.kt
new file mode 100644
index 0000000..3f1fa04
--- /dev/null
+++ b/libs/samba/src/test/java/org/the_jk/cleversync/samba/SambaTreeTest.kt
@@ -0,0 +1,39 @@
+package org.the_jk.cleversync.samba
+
+import com.google.common.truth.Truth.assertThat
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
+import org.robolectric.annotation.Config
+import org.the_jk.cleversync.io.samba.SambaCredentials
+
+@Config(manifest=Config.NONE)
+@RunWith(RobolectricTestRunner::class)
+class SambaTreeTest {
+ private lateinit var uri: String
+ private lateinit var credentials: SambaCredentials
+
+ @Before
+ fun setUp() {
+ uri = "smb://127.0.0.1:10445/"
+ credentials = SambaCredentials("test", "notverysecret")
+ }
+
+ @After
+ fun tearDown() {
+
+ }
+
+ @Test
+ fun listRoot() {
+ val result = SambaTreeFactory.tree(uri, credentials)
+ assertThat(result.isSuccess).isTrue()
+ val root = result.getOrThrow()
+ val content = root.list()
+ assertThat(content.directories).hasSize(1)
+ assertThat(content.files).isEmpty()
+ assertThat(content.links).isEmpty()
+ }
+}