1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-11 16:33:03 +00:00

detach request logic from operation

This commit is contained in:
Christian Schabesberger
2020-09-16 16:20:54 +02:00
committed by Abel García de Prada
parent 9d4b88cad7
commit 84240ef78b
3 changed files with 130 additions and 113 deletions
@@ -1,24 +1,24 @@
package com.owncloud.android.lib
import com.owncloud.android.lib.resources.status.GetRemoteStatusOperation
import com.owncloud.android.lib.resources.status.StatusRequestor
import org.junit.Assert.assertEquals
import org.junit.Test
class GetRemoteStatusOperationTest {
private val remoteStatusOperation = GetRemoteStatusOperation()
class StatusRequestorTest {
private val requestor = StatusRequestor()
@Test
fun `update location with an absolute path`() {
val newLocation = remoteStatusOperation.updateLocationWithRedirectPath(
val newLocation = requestor.updateLocationWithRedirectPath(
"https://cloud.somewhere.com", "https://cloud.somewhere.com/subdir"
)
assertEquals("https://cloud.somewhere.com/subdir", newLocation)
}
@Test
fun `update location with a smaler aboslute path`() {
val newLocation = remoteStatusOperation.updateLocationWithRedirectPath(
fun `update location with a smaler aboslute path`() {
val newLocation = requestor.updateLocationWithRedirectPath(
"https://cloud.somewhere.com/subdir", "https://cloud.somewhere.com/"
)
assertEquals("https://cloud.somewhere.com/", newLocation)
@@ -26,7 +26,7 @@ class GetRemoteStatusOperationTest {
@Test
fun `update location with a relative path`() {
val newLocation = remoteStatusOperation.updateLocationWithRedirectPath(
val newLocation = requestor.updateLocationWithRedirectPath(
"https://cloud.somewhere.com", "/subdir"
)
assertEquals("https://cloud.somewhere.com/subdir", newLocation)
@@ -34,7 +34,7 @@ class GetRemoteStatusOperationTest {
@Test
fun `update location by replacing the relative path`() {
val newLocation = remoteStatusOperation.updateLocationWithRedirectPath(
val newLocation = requestor.updateLocationWithRedirectPath(
"https://cloud.somewhere.com/some/other/subdir", "/subdir"
)
assertEquals("https://cloud.somewhere.com/subdir", newLocation)