Add testOnlyOnServer function inside AbstractIT

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-10-11 10:44:21 +02:00
parent 887c197287
commit b853dce389
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF

View file

@ -37,7 +37,9 @@ import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.UploadFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
@ -71,6 +73,7 @@ import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
/**
@ -187,6 +190,13 @@ public abstract class AbstractIT {
}
}
protected void testOnlyOnServer(OwnCloudVersion version) {
OCCapability ocCapability = (OCCapability) new GetCapabilitiesRemoteOperation()
.execute(nextcloudClient)
.getSingleData();
assumeTrue(ocCapability.getVersion().isNewerOrEqual(version));
}
@Before
public void enableAccessibilityChecks() {
androidx.test.espresso.accessibility.AccessibilityChecks.enable().setRunChecksFromRootView(true);