コード例 #1
0
 def test_that_when_create_identity_pool_and_error_thrown_the_create_identity_pool_method_returns_error(self):
     '''
     Tests the negative case where create identity pool has a boto3 client error
     '''
     self.conn.create_identity_pool.side_effect = ClientError(error_content, 'create_identity_pool')
     result = boto_cognitoidentity.create_identity_pool(IdentityPoolName='default_pool_name', **conn_parameters)
     self.assertIs(result.get('created'), False)
     self.assertEqual(result.get('error', {}).get('message'), error_message.format('create_identity_pool'))
コード例 #2
0
 def test_that_when_create_identity_pool_and_error_thrown_the_create_identity_pool_method_returns_error(self):
     """
     Tests the negative case where create identity pool has a boto3 client error
     """
     self.conn.create_identity_pool.side_effect = ClientError(error_content, "create_identity_pool")
     result = boto_cognitoidentity.create_identity_pool(IdentityPoolName="default_pool_name", **conn_parameters)
     self.assertIs(result.get("created"), False)
     self.assertEqual(result.get("error", {}).get("message"), error_message.format("create_identity_pool"))
コード例 #3
0
def test_that_when_create_identity_pool_and_error_thrown_the_create_identity_pool_method_returns_error(boto_conn):
    '''
    Tests the negative case where create identity pool has a boto3 client error
    '''
    boto_conn.create_identity_pool.side_effect = exceptions.ClientError(error_content, 'create_identity_pool')
    result = boto_cognitoidentity.create_identity_pool(IdentityPoolName='default_pool_name', **pytest.conn_parameters)
    assert result.get('created') is False
    assert result.get('error', {}).get('message') == error_message.format('create_identity_pool')
コード例 #4
0
 def test_that_when_create_identity_pool_and_error_thrown_the_create_identity_pool_method_returns_error(
     self, ):
     """
     Tests the negative case where create identity pool has a boto3 client error
     """
     self.conn.create_identity_pool.side_effect = ClientError(
         error_content, "create_identity_pool")
     result = boto_cognitoidentity.create_identity_pool(
         IdentityPoolName="default_pool_name", **conn_parameters)
     assert result.get("created") is False
     assert result.get(
         "error",
         {}).get("message") == error_message.format("create_identity_pool")
コード例 #5
0
 def test_that_when_create_identity_pool_the_create_identity_pool_method_returns_created_identity_pool(self):
     '''
     Tests the positive case where create identity pool succeeds
     '''
     return_val = default_pool_ret.copy()
     return_val.pop('DeveloperProviderName', None)
     self.conn.create_identity_pool.return_value = return_val
     result = boto_cognitoidentity.create_identity_pool(IdentityPoolName='default_pool_name', **conn_parameters)
     mock_calls = self.conn.mock_calls
     #name, args, kwargs = mock_calls[0]
     self.assertTrue(result.get('created'))
     self.assertEqual(len(mock_calls), 1)
     self.assertEqual(mock_calls[0][0], 'create_identity_pool')
     self.assertNotIn('DeveloperProviderName', mock_calls[0][2])
コード例 #6
0
 def test_that_when_create_identity_pool_the_create_identity_pool_method_returns_created_identity_pool(self):
     """
     Tests the positive case where create identity pool succeeds
     """
     return_val = default_pool_ret.copy()
     return_val.pop("DeveloperProviderName", None)
     self.conn.create_identity_pool.return_value = return_val
     result = boto_cognitoidentity.create_identity_pool(IdentityPoolName="default_pool_name", **conn_parameters)
     mock_calls = self.conn.mock_calls
     # name, args, kwargs = mock_calls[0]
     self.assertTrue(result.get("created"))
     self.assertEqual(len(mock_calls), 1)
     self.assertEqual(mock_calls[0][0], "create_identity_pool")
     self.assertNotIn("DeveloperProviderName", mock_calls[0][2])
コード例 #7
0
def test_that_when_create_identity_pool_the_create_identity_pool_method_returns_created_identity_pool(boto_conn):
    '''
    Tests the positive case where create identity pool succeeds
    '''
    return_val = default_pool_ret.copy()
    return_val.pop('DeveloperProviderName', None)
    boto_conn.create_identity_pool.return_value = return_val
    result = boto_cognitoidentity.create_identity_pool(IdentityPoolName='default_pool_name', **pytest.conn_parameters)
    mock_calls = boto_conn.mock_calls
    #name, args, kwargs = mock_calls[0]
    assert result.get('created') is True
    assert len(mock_calls) == 1
    assert mock_calls[0][0] == 'create_identity_pool'
    assert 'DeveloperProviderName' not in mock_calls[0][2]
コード例 #8
0
 def test_that_when_create_identity_pool_the_create_identity_pool_method_returns_created_identity_pool(
     self, ):
     """
     Tests the positive case where create identity pool succeeds
     """
     return_val = default_pool_ret.copy()
     return_val.pop("DeveloperProviderName", None)
     self.conn.create_identity_pool.return_value = return_val
     result = boto_cognitoidentity.create_identity_pool(
         IdentityPoolName="default_pool_name", **conn_parameters)
     mock_calls = self.conn.mock_calls
     # name, args, kwargs = mock_calls[0]
     assert result.get("created")
     assert len(mock_calls) == 1
     assert mock_calls[0][0] == "create_identity_pool"
     assert "DeveloperProviderName" not in mock_calls[0][2]