Search in sources :

Example 6 with FlowParameters

use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.

the class GenericIdpSignInHandlerTest method setUp.

@Before
public void setUp() {
    TestHelper.initialize();
    MockitoAnnotations.initMocks(this);
    FlowParameters testParams = TestHelper.getFlowParameters(Arrays.asList(MICROSOFT_PROVIDER, GoogleAuthProvider.PROVIDER_ID), /* enableAnonymousUpgrade= */
    true);
    mMockActivity = TestHelper.getHelperActivity(testParams);
    mHandler = spy(new GenericIdpSignInHandler((Application) ApplicationProvider.getApplicationContext()));
    // See https://github.com/firebase/FirebaseUI-Android/issues/1805
    Map<String, String> customParams = new HashMap<>();
    customParams.put("prompt", "select_account");
    AuthUI.IdpConfig config = new AuthUI.IdpConfig.MicrosoftBuilder().setScopes(Arrays.asList(SCOPE)).setCustomParameters(customParams).build();
    mHandler.initializeForTesting(config);
    mHandler.getOperation().observeForever(mResponseObserver);
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters) HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) GenericIdpSignInHandler(com.firebase.ui.auth.data.remote.GenericIdpSignInHandler) AuthUI(com.firebase.ui.auth.AuthUI) Before(org.junit.Before)

Example 7 with FlowParameters

use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.

the class PhoneProviderResponseHandlerTest method setupAnonymousUpgrade.

private void setupAnonymousUpgrade() {
    FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList(PhoneAuthProvider.PROVIDER_ID), true);
    mHandler.initializeForTesting(testParams, mMockAuth, null);
    when(mMockAuth.getCurrentUser()).thenReturn(mMockUser);
    when(mMockUser.isAnonymous()).thenReturn(true);
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters)

Example 8 with FlowParameters

use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.

the class AnonymousSignInHandlerTest method setUp.

@Before
public void setUp() {
    TestHelper.initialize();
    MockitoAnnotations.initMocks(this);
    FlowParameters testParams = TestHelper.getFlowParameters(new ArrayList<String>());
    mMockActivity = TestHelper.getHelperActivity(testParams);
    mHandler = new AnonymousSignInHandler((Application) ApplicationProvider.getApplicationContext());
    mHandler.init(testParams);
    mHandler.mAuth = mMockAuth;
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters) AnonymousSignInHandler(com.firebase.ui.auth.data.remote.AnonymousSignInHandler) Application(android.app.Application) Before(org.junit.Before)

Example 9 with FlowParameters

use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.

the class SmartLockHandlerTest method setUp.

@Before
public void setUp() {
    TestHelper.initialize();
    MockitoAnnotations.initMocks(this);
    mHandler = new SmartLockHandler((Application) ApplicationProvider.getApplicationContext());
    FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList(EmailAuthProvider.PROVIDER_ID));
    mHandler.initializeForTesting(testParams, mMockAuth, mMockCredentials);
    mHandler.setResponse(new IdpResponse.Builder(new User.Builder(EmailAuthProvider.PROVIDER_ID, TestConstants.EMAIL).build()).build());
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters) SmartLockHandler(com.firebase.ui.auth.viewmodel.smartlock.SmartLockHandler) Application(android.app.Application) Before(org.junit.Before)

Example 10 with FlowParameters

use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.

the class WelcomeBackPasswordHandlerTest method setupAnonymousUpgrade.

private void setupAnonymousUpgrade() {
    // enableAnonymousUpgrade must be set to true
    FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList(EmailAuthProvider.PROVIDER_ID), /* enableAnonymousUpgrade */
    true);
    mHandler.initializeForTesting(testParams, mMockAuth, mMockCredentials);
    // Mock isAnonymous() to return true so canUpgradeAnonymous will return true
    when(mUser.isAnonymous()).thenReturn(true);
    when(mMockAuth.getCurrentUser()).thenReturn(mUser);
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters)

Aggregations

FlowParameters (com.firebase.ui.auth.data.model.FlowParameters)27 Before (org.junit.Before)10 Application (android.app.Application)9 Test (org.junit.Test)4 AuthUI (com.firebase.ui.auth.AuthUI)3 OAuthProvider (com.google.firebase.auth.OAuthProvider)3 HashMap (java.util.HashMap)3 TextView (android.widget.TextView)2 FirebaseAuthAnonymousUpgradeException (com.firebase.ui.auth.FirebaseAuthAnonymousUpgradeException)2 FirebaseUiException (com.firebase.ui.auth.FirebaseUiException)2 IdpResponse (com.firebase.ui.auth.IdpResponse)2 UserCancellationException (com.firebase.ui.auth.data.model.UserCancellationException)2 SocialProviderResponseHandler (com.firebase.ui.auth.viewmodel.idp.SocialProviderResponseHandler)2 Intent (android.content.Intent)1 ImageView (android.widget.ImageView)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 RestrictTo (androidx.annotation.RestrictTo)1 VisibleForTesting (androidx.annotation.VisibleForTesting)1 ConstraintLayout (androidx.constraintlayout.widget.ConstraintLayout)1