Search in sources :

Example 1 with Authenticator

use of com.vodafone360.people.service.Authenticator in project 360-Engine-for-Android by 360.

the class AuthenticatorTest method testHasFeatures.

/***
     * Test the hasFeatures() method.
     */
@SmallTest
public final void testHasFeatures() {
    Authenticator authenticator = new Authenticator(getContext(), mApplication);
    assertFalse("Expected hasFeatures() to return bundle boolean KEY_BOOLEAN_RESULT as FALSE", authenticator.hasFeatures(null, null, null).getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
}
Also used : Authenticator(com.vodafone360.people.service.Authenticator) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with Authenticator

use of com.vodafone360.people.service.Authenticator in project 360-Engine-for-Android by 360.

the class AuthenticatorTest method testGetAuthToken.

/***
     * Test the getAuthToken() method.
     */
@SmallTest
public final void testGetAuthToken() {
    Authenticator authenticator = new Authenticator(getContext(), mApplication);
    assertNull("Expected getAuthToken() to return NULL", authenticator.getAuthToken(null, null, null, null));
}
Also used : Authenticator(com.vodafone360.people.service.Authenticator) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with Authenticator

use of com.vodafone360.people.service.Authenticator in project 360-Engine-for-Android by 360.

the class AuthenticatorTest method testGetAuthTokenLabel.

/***
     * Test the getAuthTokenLabel() method.
     */
@SmallTest
public final void testGetAuthTokenLabel() {
    Authenticator authenticator = new Authenticator(getContext(), mApplication);
    assertNull("Expected getAuthTokenLabel() to return NULL", authenticator.getAuthTokenLabel(null));
}
Also used : Authenticator(com.vodafone360.people.service.Authenticator) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with Authenticator

use of com.vodafone360.people.service.Authenticator in project 360-Engine-for-Android by 360.

the class AuthenticatorTest method testGetAccountRemovalAllowed.

/***
     * Test the getAccountRemovalAllowed() method.
     */
@SmallTest
@Suppress
public final void testGetAccountRemovalAllowed() {
    final TestStatus testStatus = new TestStatus();
    Authenticator authenticator = new Authenticator(getContext(), new MainApplication() {

        public void removeUserData() {
            /*
                 * Test that the dummy mWakeListener.notifyOfWakeupAlarm() has
                 * been called, otherwise the test must fail.
                 */
            testStatus.setPass(true);
        }
    });
    Bundle bundle = null;
    try {
        bundle = authenticator.getAccountRemovalAllowed(null, null);
    } catch (NetworkErrorException e) {
        fail("Unexpected NetworkErrorException");
    }
    /** Test if removeUserData() was called. **/
    assertTrue("Expecting the removeUserData() dummy method to have " + "been called", testStatus.isPass());
    assertEquals("Expected a KEY_BOOLEAN_RESULT boolean", true, bundle.getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
}
Also used : NetworkErrorException(android.accounts.NetworkErrorException) TestStatus(com.vodafone360.people.tests.testutils.TestStatus) Bundle(android.os.Bundle) Authenticator(com.vodafone360.people.service.Authenticator) MainApplication(com.vodafone360.people.MainApplication) SmallTest(android.test.suitebuilder.annotation.SmallTest) Suppress(android.test.suitebuilder.annotation.Suppress)

Example 5 with Authenticator

use of com.vodafone360.people.service.Authenticator in project 360-Engine-for-Android by 360.

the class AuthenticatorTest method testEditProperties.

/***
     * Test the editProperties() method.
     */
@SmallTest
public final void testEditProperties() {
    Authenticator authenticator = new Authenticator(getContext(), mApplication);
    try {
        authenticator.editProperties(null, null);
        fail("Expected editProperties() to throw an UnsupportedOperationException");
    } catch (UnsupportedOperationException e) {
        assertTrue("UnsupportedOperationException thrown as expected", true);
    } catch (Exception e) {
        fail("Expected editProperties() to throw an UnsupportedOperationException");
    }
}
Also used : Authenticator(com.vodafone360.people.service.Authenticator) NetworkErrorException(android.accounts.NetworkErrorException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)9 Authenticator (com.vodafone360.people.service.Authenticator)9 NetworkErrorException (android.accounts.NetworkErrorException)2 Bundle (android.os.Bundle)2 Intent (android.content.Intent)1 Suppress (android.test.suitebuilder.annotation.Suppress)1 MainApplication (com.vodafone360.people.MainApplication)1 TestStatus (com.vodafone360.people.tests.testutils.TestStatus)1