Skip to content

Commit

Permalink
enable tests that use exfiltration data service (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanag13 committed Sep 15, 2021
1 parent e75b34c commit 52e3037
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
127.0.0.1 file-events
127.0.0.1 storage
127.0.0.1 preservation-data-service
127.0.0.1 exfiltration-data-service
127.0.0.1 connected-server
127.0.0.1 cases
EOF
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ignore =
E722
# binary operation line break, different opinion from black
W503
# exception chaining
B904
# up to 88 allowed by bugbear B950
max-line-length = 80
per-file-ignores =
Expand Down
3 changes: 2 additions & 1 deletion src/py42/services/storage/exfiltrateddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def get_download_token(self, event_id, device_id, file_path, timestamp):
params = "deviceUid={}&eventId={}&filePath={}&versionTimestamp={}"
params = params.format(device_id, event_id, quote(file_path), timestamp)
resource = "file-download-token"
headers = {"Accept": "*/*"}
uri = f"{self._base_uri}{resource}?{params}"
return self._connection.get(uri)
return self._connection.get(uri, headers=headers)

def get_file(self, token):
"""Streams a file.
Expand Down
10 changes: 4 additions & 6 deletions tests/integration/test_securitydata.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ def test_search_file_events(self, connection):
assert_successful_response(response)

def test_stream_file_by_md5(self, connection, md5_hash, file_data):
pass
# response = connection.securitydata.stream_file_by_md5(md5_hash)
# assert str(response) == file_data
response = connection.securitydata.stream_file_by_md5(md5_hash)
assert str(response) == file_data

def test_stream_file_by_sha256(self, connection, sha256_hash, file_data):
pass
# response = connection.securitydata.stream_file_by_sha256(sha256_hash)
# assert str(response) == file_data
response = connection.securitydata.stream_file_by_sha256(sha256_hash)
assert str(response) == file_data
4 changes: 3 additions & 1 deletion tests/services/storage/test_exfiltrateddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def test_get_download_token_calls_get_with_valid_params(
service.get_download_token("testeventid", "testdeviceid", "testfilepath", 1223)
qry = "deviceUid=testdeviceid&eventId=testeventid&filePath=testfilepath&versionTimestamp=1223"
expected = f"api/v1/file-download-token?{qry}"
mock_successful_connection.get.assert_called_once_with(expected)
mock_successful_connection.get.assert_called_once_with(
expected, headers={"Accept": "*/*"}
)

def test_get_file_calls_get_with_valid_params(
self, mock_successful_connection, mock_request
Expand Down

0 comments on commit 52e3037

Please sign in to comment.