Skip to content

Commit

Permalink
apply required fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
theScrabi committed Aug 17, 2021
1 parent 956c05b commit 10d0c34
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 51 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ buildscript {
fragmentTestVersion = "1.1.0"
uiAutomatorTestVersion = "2.2.0"
annotationTestVersion = "1.2.0"
robolectricVersion = "4.4"

// Extensions
ktxVersion = "1.1.0"
Expand Down
3 changes: 0 additions & 3 deletions owncloudApp/src/main/java/com/owncloud/android/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import com.owncloud.android.dependecyinjection.repositoryModule
import com.owncloud.android.dependecyinjection.useCaseModule
import com.owncloud.android.dependecyinjection.viewModelModule
import com.owncloud.android.extensions.createNotificationChannel
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.SingleSessionManager
import com.owncloud.android.presentation.ui.settings.fragments.SettingsLogsFragment
import com.owncloud.android.providers.LogsProvider
Expand Down Expand Up @@ -75,8 +74,6 @@ class MainApp : Application() {

startLogsIfEnabled()

OwnCloudClient.setContext(appContext)

createNotificationChannels()

SingleSessionManager.setUserAgent(userAgent)
Expand Down
6 changes: 0 additions & 6 deletions owncloudData/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ android {
// Room Database Tests
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}

testOptions {
unitTests {
includeAndroidResources = true
}
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ClientManager(
val safeClient = ownCloudClient

return if (requiresNewClient || safeClient == null) {
OwnCloudClient(Uri.parse(path)).apply {
OwnCloudClient(Uri.parse(path), context).apply {
credentials = ownCloudCredentials
}.also {
ownCloudClient = it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ class OCRemoteServerInfoDataSource(

var checkPathExistenceResult =
serverInfoService.checkPathExistence(path, isUserLogged = false, owncloudClient)
var redirectionLocation = checkPathExistenceResult.redirectedLocation
while (!redirectionLocation.isNullOrEmpty()) {
checkPathExistenceResult =
serverInfoService.checkPathExistence(redirectionLocation, isUserLogged = false, owncloudClient)
redirectionLocation = checkPathExistenceResult.redirectedLocation
}

// Step 2: Check if server is available (If server is in maintenance for example, throw exception with specific message)
if (checkPathExistenceResult.httpCode == HttpConstants.HTTP_SERVICE_UNAVAILABLE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,39 +69,6 @@ class OCRemoteServerInfoDataSourceTest {
every { clientManager.getClientForUnExistingAccount(any(), any()) } returns ocClientMocked
}

@Test
fun getAuthenticationMethodFollowRedirections() {
val checkPathExistenceResultFollowRedirectionMocked: RemoteOperationResult<Boolean> =
createRemoteOperationResultMock(
data = true,
isSuccess = true,
redirectedLocation = OC_SERVER_INFO.baseUrl
)
val checkPathExistenceResultMocked: RemoteOperationResult<Boolean> =
createRemoteOperationResultMock(
data = true,
isSuccess = true,
resultCode = OK_SSL,
authenticationHeader = authHeadersBasic,
httpCode = HTTP_UNAUTHORIZED
)

every {
ocServerInfoService.checkPathExistence(redirectedLocation, false, ocClientMocked)
} returns checkPathExistenceResultFollowRedirectionMocked

every {
ocServerInfoService.checkPathExistence(OC_SERVER_INFO.baseUrl, false, ocClientMocked)
} returns checkPathExistenceResultMocked

val authenticationMethod = ocRemoteServerInfoDatasource.getAuthenticationMethod(redirectedLocation)

assertNotNull(authenticationMethod)
assertEquals(AuthenticationMethod.BASIC_HTTP_AUTH, authenticationMethod)

verify { ocServerInfoService.checkPathExistence(OC_SERVER_INFO.baseUrl, false, ocClientMocked) }
}

@Test
fun getAuthenticationMethodBasic() {
val expectedValue = AuthenticationMethod.BASIC_HTTP_AUTH
Expand Down

0 comments on commit 10d0c34

Please sign in to comment.