Skip to content

Commit

Permalink
Merge pull request #598 from nextcloud/backport/592/stable-2.6
Browse files Browse the repository at this point in the history
[stable-2.6] Use new result data for templates
  • Loading branch information
tobiasKaminsky authored Mar 17, 2021
2 parents acf2054 + 481cba2 commit ebcb7eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testGetAll() {
.execute(client);
assertTrue(result.isSuccess());

TemplateList templateList = (TemplateList) result.getSingleData();
TemplateList templateList = (TemplateList) result.getResultData();

assertEquals("Empty file", templateList.templates.get("empty").title);
assertEquals("md", templateList.templates.get("empty").extension);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected RemoteOperationResult<TemplateList> run(OwnCloudClient client) {
.getOcs().getData();

result = new RemoteOperationResult<>(true, getMethod);
result.setSingleData(templateList);
result.setResultData(templateList);
} else {
result = new RemoteOperationResult<>(false, getMethod);
client.exhaustResponse(getMethod.getResponseBodyAsStream());
Expand Down

0 comments on commit ebcb7eb

Please sign in to comment.