use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.
the class AuthUITest method testCreatingStartIntent.
@Test
public void testCreatingStartIntent() {
FlowParameters flowParameters = mAuthUi.createSignInIntentBuilder().setAvailableProviders(Arrays.asList(new IdpConfig.EmailBuilder().build(), new IdpConfig.GoogleBuilder().build(), new IdpConfig.FacebookBuilder().build(), new IdpConfig.AnonymousBuilder().build())).setTosAndPrivacyPolicyUrls(TestConstants.TOS_URL, TestConstants.PRIVACY_URL).build().getParcelableExtra(ExtraConstants.FLOW_PARAMS);
assertEquals(4, flowParameters.providers.size());
assertEquals(TestHelper.MOCK_APP.getName(), flowParameters.appName);
assertEquals(TestConstants.TOS_URL, flowParameters.termsOfServiceUrl);
assertEquals(TestConstants.PRIVACY_URL, flowParameters.privacyPolicyUrl);
assertEquals(AuthUI.getDefaultTheme(), flowParameters.themeId);
assertTrue(flowParameters.shouldShowProviderChoice());
assertEquals(new IdpConfig.EmailBuilder().build(), flowParameters.getDefaultOrFirstProvider());
}
use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.
the class AuthUITest method testCustomAuthMethodPickerLayout.
@Test
public void testCustomAuthMethodPickerLayout() {
// Testing with some random layout res
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout.Builder(R.layout.fui_phone_layout).setAnonymousButtonId(123).build();
FlowParameters flowParameters = mAuthUi.createSignInIntentBuilder().setAuthMethodPickerLayout(customLayout).build().getParcelableExtra(ExtraConstants.FLOW_PARAMS);
assert flowParameters.authMethodPickerLayout != null;
assertEquals(customLayout.getMainLayout(), flowParameters.authMethodPickerLayout.getMainLayout());
}
use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.
the class EmailLinkSignInHandlerTest method setupAnonymousUpgrade.
private void setupAnonymousUpgrade() {
// enableAnonymousUpgrade must be set to true
FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList(EmailAuthProvider.PROVIDER_ID), /* enableAnonymousUpgrade */
true);
testParams.emailLink = mHandler.getArguments().emailLink;
mHandler.initializeForTesting(testParams, mMockAuth, null);
// Mock isAnonymous() to return true so canUpgradeAnonymous will return true
when(mMockAnonUser.isAnonymous()).thenReturn(true);
when(mMockAuth.getCurrentUser()).thenReturn(mMockAnonUser);
}
use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.
the class PhoneProviderResponseHandlerTest method setUp.
@Before
public void setUp() {
TestHelper.initialize();
MockitoAnnotations.initMocks(this);
mCredential = PhoneAuthCredential.zzc("sessionInfo", "SmsCode");
mHandler = new PhoneProviderResponseHandler((Application) ApplicationProvider.getApplicationContext());
FlowParameters testParams = TestHelper.getFlowParameters(Collections.singletonList(PhoneAuthProvider.PROVIDER_ID));
mHandler.initializeForTesting(testParams, mMockAuth, null);
}
use of com.firebase.ui.auth.data.model.FlowParameters in project FirebaseUI-Android by firebase.
the class AuthUITest method testCreateStartIntent_shouldHaveEmailAsDefaultProvider.
@Test
public void testCreateStartIntent_shouldHaveEmailAsDefaultProvider() {
FlowParameters flowParameters = mAuthUi.createSignInIntentBuilder().build().getParcelableExtra(ExtraConstants.FLOW_PARAMS);
assertEquals(1, flowParameters.providers.size());
assertEquals(EmailAuthProvider.PROVIDER_ID, flowParameters.providers.get(0).getProviderId());
}
Aggregations