Esempio n. 1
0
def test_handler_without_next_token(mock_threatstream_connect, mock_ssm,
                                    mock_ti_config):  # pylint: disable=unused-argument
    """Threat Intel Downloader - Test handler"""
    mock_ssm.return_value = MockSSMClient(suppress_params=True,
                                          parameters=mock_ssm_response())
    handler(None, get_mock_context())
    mock_threatstream_connect.assert_not_called()
Esempio n. 2
0
def test_parse_config():
    """Threat Intel Downloader - Test parse_lambda_func_arn"""
    expect_config = {
        'region': 'us-east-1',
        'account_id': '123456789012',
        'function_name': 'prefix_threat_intel_downloader',
        'qualifier': 'development'
    }
    assert_equal(parse_lambda_func_arn(get_mock_context()), expect_config)
Esempio n. 3
0
def test_handler_next_token(mock_get, mock_ssm):
    """Threat Intel Downloader - Test handler with next token passed in"""
    mock_ssm.return_value = MockSSMClient(suppress_params=True,
                                          parameters=mock_ssm_response())
    handler({'next_url': 'next_token'}, get_mock_context())
    mock_get.assert_called()
Esempio n. 4
0
 def setup(self):
     """Setup TestThreatStream"""
     context = get_mock_context(100000)
     self.threatstream = ThreatStream(context.invoked_function_arn,
                                      context.get_remaining_time_in_millis)
Esempio n. 5
0
 def setup(self):
     """Setup TestThreatStream"""
     # pylint: disable=attribute-defined-outside-init
     context = get_mock_context(100000)
     self.threatstream = ThreatStream(context.invoked_function_arn,
                                      context.get_remaining_time_in_millis)