Skip to content

Commit

Permalink
Fix some rule test bugs (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinbyers authored Mar 22, 2018
1 parent 7d2804d commit e64e643
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stream_alert/alert_processor/outputs/output_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class OutputDispatcher(object):
def __init__(self, region, account_id, prefix, config):
self.region = region
self.account_id = account_id
self.secrets_bucket = '{}_streamalert_secrets'.format(prefix)
self.secrets_bucket = '{}.streamalert.secrets'.format(prefix)
self.config = config

@staticmethod
Expand Down
2 changes: 0 additions & 2 deletions stream_alert_cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ def setup_mock_firehose_delivery_streams(config):
create_delivery_stream(region, stream_name, prefix)


@mock_dynamodb2
def setup_mock_dynamodb_ioc_table(config):
"""Mock DynamoDB IOC table for rule testing
Expand Down Expand Up @@ -489,7 +488,6 @@ def setup_mock_dynamodb_ioc_table(config):
TableName=table_name)


@mock_dynamodb2
def setup_mock_alerts_table(table_name):
"""Create a mock DynamoDB alerts table used by rule processor, alert processor, alert merger"""
boto3.client('dynamodb').create_table(
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/stream_alert_alert_merger/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
_ALERT_PROCESSOR_TIMEOUT_SEC = 60


@mock_dynamodb2
class TestAlertTable(object):
"""Tests for merger/main.py:AlertTable"""

@patch.dict(os.environ, {'AWS_DEFAULT_REGION': 'us-east-1'})
def setup(self):
"""Alert Merger - Alert Table - Add mock alerts to the table"""
# pylint: disable=attribute-defined-outside-init
self.dynamo_mock = mock_dynamodb2()
self.dynamo_mock.start()

setup_mock_alerts_table(_ALERTS_TABLE)
self.alert_table = main.AlertTable(_ALERTS_TABLE)

Expand All @@ -62,6 +64,10 @@ def setup(self):
})
})

def teardown(self):
"""Alert Merger - Teardown - Stop Mocks"""
self.dynamo_mock.stop()

def test_paginate_multiple(self):
"""Alert Merger - Alert Table - Paginate Traverses Multiple Pages"""
def mock_table_op(**kwargs):
Expand Down

0 comments on commit e64e643

Please sign in to comment.