From 481cba29ff5bf47f7ec86ba46702a3dfd073b1de Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 17 Mar 2021 06:49:28 +0100 Subject: [PATCH] update test depending on server version Signed-off-by: tobiasKaminsky --- .../shares/UpdateShareRemoteOperationIT.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/androidTest/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperationIT.kt b/src/androidTest/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperationIT.kt index e237d3efc..3288a24b1 100644 --- a/src/androidTest/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperationIT.kt +++ b/src/androidTest/java/com/owncloud/android/lib/resources/shares/UpdateShareRemoteOperationIT.kt @@ -24,6 +24,9 @@ package com.owncloud.android.lib.resources.shares import com.owncloud.android.AbstractIT import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation +import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation +import com.owncloud.android.lib.resources.status.NextcloudVersion +import com.owncloud.android.lib.resources.status.OCCapability import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue @@ -149,7 +152,15 @@ class UpdateShareRemoteOperationIT : AbstractIT() { val result = sut.execute(client) assertFalse(result.isSuccess) - assertEquals("Password needs to be at least 8 characters long.", result.message) + + val capabilityResult = GetCapabilitiesRemoteOperation().execute(nextcloudClient) + Assert.assertTrue(capabilityResult.isSuccess) + val capability = capabilityResult.singleData as OCCapability + if (capability.version.isNewerOrEqual(NextcloudVersion.nextcloud_21)) { + assertEquals("Password needs to be at least 8 characters long.", result.message) + } else { + assertEquals("Password needs to be at least 8 characters long", result.message) + } assertTrue(RemoveFileRemoteOperation(folder).execute(client).isSuccess) }