use of com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool in project aws-sdk-android by aws-amplify.
the class CognitoIdentityProviderUserPoolTest method init.
@Before
public void init() {
if (firstTime) {
// Initialization
MockitoAnnotations.initMocks(this);
testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET);
awsKeyValueStorageUtility = getAWSKeyValueStorageUtility(testPool);
// Data for tests
TEST_IN_USER_ATTRIBUTES_LIST = new CognitoUserAttributes();
TEST_IN_USER_ATTRIBUTES_LIST.addAttribute("email", TEST_USER_EMAIL);
TEST_IN_USER_ATTRIBUTES_LIST.addAttribute("phone_number", TEST_USER_PHONE);
TEST_IN_VALIDATION_DATA = new HashMap<String, String>();
TEST_IN_VALIDATION_DATA.put("DummyAttribute_1", "Value4DummyAttribute_1");
TEST_IN_VALIDATION_DATA.put("DummyAttribute_2", "Value4DummyAttribute_2");
TEST_IN_VALIDATION_DATA.put("DummyAttribute_3", "Value4DummyAttribute_3");
TEST_REGISTER_USER_RESPONSE = new SignUpResult();
TEST_REGISTER_USER_RESPONSE.setUserConfirmed(true);
TEST_REGISTER_USER_RESPONSE.setCodeDeliveryDetails(TEST_CODE_DELIVERY_DETAIL);
firstTime = false;
}
}
use of com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool in project aws-sdk-android by aws-amplify.
the class CognitoIdentityProviderUserPoolTest method signUpInBackgroundUnexpectedLambdaException.
// Sign-up failure
@Test
public void signUpInBackgroundUnexpectedLambdaException() throws Exception {
testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET, mockCSIClient);
UnexpectedLambdaException exception = new UnexpectedLambdaException("registration failed");
doThrow(exception).when(mockCSIClient).signUp(any(SignUpRequest.class));
testPool.signUpInBackground(TEST_USER_NAME, "null", TEST_IN_USER_ATTRIBUTES_LIST, TEST_IN_VALIDATION_DATA, new SignUpHandler() {
@Override
public void onSuccess(CognitoUser user, SignUpResult signUpResult) {
assertNotNull(user);
assertEquals(TEST_USER_NAME, user.getUserId());
}
@Override
public void onFailure(Exception exception) {
assertNotNull(exception);
assertTrue(exception instanceof UnexpectedLambdaException);
}
});
}
use of com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool in project aws-sdk-android by aws-amplify.
the class CognitoIdentityProviderCustomEndPointTest method testForCustomEndpointWhenEmpty.
/**
* Test that end point is not set for the {@link AmazonCognitoIdentityProviderClient }
* when {@link CognitoUserPool#CognitoUserPool(Context, String, String, String, AmazonCognitoIdentityProvider, String, String)} is called
* with an empty endpoint
*/
@Test
public void testForCustomEndpointWhenEmpty() {
testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET, mockCustomEndpointClient, TEST_PINPOINT_APP_ID, "");
verifyZeroInteractions(mockCustomEndpointClient);
}
use of com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool in project aws-sdk-android by aws-amplify.
the class CognitoIdentityProviderCustomEndPointTest method testForCustomEndpoint.
/**
* Test that end point is set for the {@link AmazonCognitoIdentityProviderClient } with correct value
* when {@link CognitoUserPool#CognitoUserPool(Context, String, String, String, AmazonCognitoIdentityProvider, String, String)} is called
* with a valid endpoint
*/
@Test
public void testForCustomEndpoint() {
testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET, mockCustomEndpointClient, TEST_PINPOINT_APP_ID, DUMMY_CUSTOM_ENDPOINT);
verify(mockCustomEndpointClient).setEndpoint(DUMMY_CUSTOM_ENDPOINT);
}
use of com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool in project aws-sdk-android by aws-amplify.
the class CognitoIdentityProviderCustomEndPointTest method testForCustomEndpointWhenNull.
/**
* Test that end point is not set for the {@link AmazonCognitoIdentityProviderClient }
* when {@link CognitoUserPool#CognitoUserPool(Context, String, String, String, AmazonCognitoIdentityProvider, String, String)} is called
* with a null endpoint
*/
@Test
public void testForCustomEndpointWhenNull() {
testPool = new CognitoUserPool(appContext, TEST_USER_POOL, TEST_CLIENT_ID, TEST_CLIENT_SECRET, mockCustomEndpointClient, TEST_PINPOINT_APP_ID, null);
verifyZeroInteractions(mockCustomEndpointClient);
}
Aggregations