-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor tests to new unixified structure, remove old generate-policy…
… command and clean up #38
- Loading branch information
Showing
13 changed files
with
191 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.4.5 | ||
current_version = 0.5.0 | ||
commit = True | ||
tag = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import datetime | ||
import logging | ||
|
||
from trailscraper import cloudtrail | ||
from trailscraper.cloudtrail import Record, filter_records | ||
|
||
|
||
def test_should_filter_for_event_time(): | ||
records = [ | ||
Record("autoscaling.amazonaws.com", "DescribeLaunchConfigurations", event_time=datetime.datetime(2017, 1, 1)), | ||
Record("sts.amazonaws.com", "AssumeRole", event_time=datetime.datetime(2017, 6, 6)) | ||
] | ||
|
||
assert filter_records(records, | ||
from_date=datetime.datetime(2017, 1, 1), | ||
to_date=datetime.datetime(2017, 3, 1)) == \ | ||
[ | ||
Record("autoscaling.amazonaws.com", "DescribeLaunchConfigurations", | ||
event_time=datetime.datetime(2017, 1, 1)), | ||
] | ||
|
||
|
||
def test_should_warn_if_records_passed_but_filtered_away(caplog): | ||
records = [ | ||
Record("autoscaling.amazonaws.com", "DescribeLaunchConfigurations", event_time=datetime.datetime(2017, 1, 1)), | ||
Record("sts.amazonaws.com", "AssumeRole", event_time=datetime.datetime(2017, 6, 6)) | ||
] | ||
|
||
assert filter_records(records, | ||
from_date=datetime.datetime(2010, 1, 1), | ||
to_date=datetime.datetime(2010, 1, 2)) == [] | ||
|
||
assert caplog.record_tuples == [ | ||
('root', logging.WARNING, cloudtrail.ALL_RECORDS_FILTERED), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.