-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from brighthive/fixes
Fixes
- Loading branch information
Showing
10 changed files
with
104 additions
and
37 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
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 +1,2 @@ | ||
from data_trust_logger.utilities.secure_requests import get_access_token, secure_get | ||
from data_trust_logger.utilities.secure_requests import get_access_token, read_token, secure_get | ||
from data_trust_logger.utilities.basic_logger import basic_logger |
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,11 @@ | ||
import logging | ||
|
||
|
||
basic_logger = logging.getLogger("basic_logger") | ||
|
||
handler = logging.StreamHandler() | ||
handler.setLevel(logging.DEBUG) | ||
formatter = logging.Formatter(fmt='[%(asctime)s] [%(levelname)s] %(message)s', datefmt="%a, %d %b %Y %H:%M:%S") | ||
handler.setFormatter(formatter) | ||
|
||
basic_logger.addHandler(handler) |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import re | ||
from unittest.mock import mock_open | ||
|
||
from expects import be, equal, expect, have_key, have_len | ||
|
||
from data_trust_logger.health_audit.mci_collector import \ | ||
instantiate_mci_collector | ||
|
||
|
||
def test_get_statuses_with_invalid_token(client, mocker): | ||
""" | ||
Test that endpoints return a 401 status code when `/tmp/token.txt` does not contain a valid token. | ||
""" | ||
mocker.patch('data_trust_logger.utilities.secure_requests.open', mock_open(read_data='invalid token')) | ||
collector = instantiate_mci_collector() | ||
metrics = collector.collect_metrics() | ||
|
||
for entry in metrics: | ||
expect(entry['endpoint_health']).to(equal(401)) |