mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Added test to unit tests for OwnCloudClient
This commit is contained in:
parent
a57be36925
commit
4c8f31df2f
@ -284,6 +284,9 @@ public class OwnCloudClient extends HttpClient {
|
||||
* @param uri
|
||||
*/
|
||||
public void setBaseUri(Uri uri) {
|
||||
if (uri == null) {
|
||||
throw new IllegalArgumentException("URI cannot be NULL");
|
||||
}
|
||||
mBaseUri = uri;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,6 @@ public abstract class RemoteOperation implements Runnable {
|
||||
/** DEPRECATED BLOCK - will be removed at version 1.0 ; don't trust in this code
|
||||
* to trigger authentication update */
|
||||
if (mCallerActivity != null && mAccount != null && mContext != null && !result.isSuccess() &&
|
||||
// (result.getCode() == ResultCode.UNAUTHORIZED || (result.isTemporalRedirection() && result.isIdPRedirection()))) {
|
||||
(result.getCode() == ResultCode.UNAUTHORIZED || result.isIdPRedirection())) {
|
||||
/// possible fail due to lack of authorization in an operation performed in foreground
|
||||
OwnCloudCredentials cred = mClient.getCredentials();
|
||||
|
@ -303,6 +303,9 @@ public class OwnCloudClientTest extends AndroidTestCase {
|
||||
assertTrue("WebDAV URI does not point to the right entry point for OAuth2 " +
|
||||
"authenticated servers",
|
||||
webdavUri.getPath().endsWith(AccountUtils.ODAV_PATH));
|
||||
assertTrue("WebDAV URI is not a subpath of base URI",
|
||||
webdavUri.getAuthority().equals(mServerUri.getAuthority()) &&
|
||||
webdavUri.getPath().startsWith(mServerUri.getPath()));
|
||||
|
||||
client.setCredentials(OwnCloudCredentialsFactory.newBasicCredentials(
|
||||
mUsername, mPassword));
|
||||
@ -331,21 +334,24 @@ public class OwnCloudClientTest extends AndroidTestCase {
|
||||
|
||||
|
||||
public void testGetSetBaseUri() {
|
||||
// TODO implement test body
|
||||
/**
|
||||
* Sets the root URI to the ownCloud server.
|
||||
*
|
||||
* Use with care.
|
||||
*
|
||||
* @param uri
|
||||
*-/
|
||||
public void setBaseUri(Uri uri) {
|
||||
mBaseUri = uri;
|
||||
OwnCloudClient client =
|
||||
new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager());
|
||||
assertEquals("Returned base URI different that URI passed to constructor",
|
||||
mServerUri, client.getBaseUri());
|
||||
|
||||
Uri otherUri = Uri.parse("https://whatever.com/basePath/here");
|
||||
client.setBaseUri(otherUri);
|
||||
assertEquals("Returned base URI different that URI passed to constructor",
|
||||
otherUri, client.getBaseUri());
|
||||
|
||||
try {
|
||||
client.setBaseUri(null);
|
||||
throw new AssertionFailedError("Accepted NULL parameter");
|
||||
|
||||
} catch(Exception e) {
|
||||
assertTrue("Unexpected exception passing NULL base URI",
|
||||
(e instanceof IllegalArgumentException));
|
||||
}
|
||||
public Uri getBaseUri() {
|
||||
return mBaseUri;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -368,8 +374,7 @@ public class OwnCloudClientTest extends AndroidTestCase {
|
||||
|
||||
|
||||
public void testSetFollowRedirects() {
|
||||
// TODO implement test body
|
||||
// to implement this we need a redirected server
|
||||
// TODO - to implement this test we need a redirected server
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user