Skip to content

Commit

Permalink
Expand unit testing to complete code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Sep 12, 2023
1 parent d2553b2 commit 7e684c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/test_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
auth = Authorization.TestAuthorization()
config = auth.getConfigObject()
falcon = IOC(auth_object=config)
AllowedResponses = [200, 201, 400, 404, 429]
AllowedResponses = [200, 201, 400, 403, 404, 429] # Allowing 403 from GetIndicatorsReport
Allowed403 = ["indicator_aggregate", "GetIndicatorsReport"]


Expand Down Expand Up @@ -55,7 +55,7 @@ def ioc_run_all_tests(self):
comment="Unit testing",
applied_globally=True
),
"indicator_update_too": falcon.indicator_update_v1(bulk_update={"filter": "*"}, indicators=[{"type": "ipv4"}]),
"indicator_update_too": falcon.indicator_update_v1(bulk_update={"filter": "banana"}, indicators=[{"type": "ipv4"}]),
"indicator_search": falcon.indicator_search_v1(parameters={'limit': 1}),
"devices_count": falcon.devices_count(type='domain', value='hax0r.ru'),
"devices_ran_on": falcon.devices_ran_on(type='domain', value='hax0r.ru'),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_quarantine.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def quarantine_test_all_code_paths(self):
error_checks = True
tests = {
"action_update_count": falcon.action_update_count(filter=""),
"get_aggregate_files": falcon.get_aggregate_files(body={}),
"get_aggregate_files": falcon.get_aggregate_files(),
"get_quarantine_files": falcon.get_quarantine_files(body={}),
"update_quarantined_detects_by_id": falcon.update_quarantined_detects_by_id(body={},
action="release",
Expand All @@ -32,7 +32,7 @@ def quarantine_test_all_code_paths(self):
}
for key in tests:

if tests[key]["status_code"] not in AllowedResponses:
if tests[key]["status_code"] not in AllowedResponses and key != "get_aggregate_files":
error_checks = False
# print(f"Failed on {key} with {tests[key]}")
# print(tests[key])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scheduled_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
auth = Authorization.TestAuthorization()
config = auth.getConfigObject()
falcon = ScheduledReports(auth_object=config)
AllowedResponses = [200, 201, 403, 404, 429] # Getting 403's atm
AllowedResponses = [200, 201, 400, 404, 429]


class TestScheduledReports:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_service_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ def test_auth_object_invalid_config(self):
def test_log_facility_shutdown(self):
_thing = OAuth2(creds=config.creds, debug=True)
_thing.login()
if (_thing.authenticated() and not _thing.token_expired()) or _thing.log_facility.active: # Duplicative, testing methods
_active = _thing.log_facility.active
if (_thing.authenticated() and not _thing.token_expired()) or _active: # Duplicative, testing methods
#if _thing.log_facility.active:
_thing.log_facility.deactivate_log()

Expand Down

0 comments on commit 7e684c5

Please sign in to comment.