Skip to content

Commit

Permalink
Merge pull request #3 from CybercentreCanada/submission_classificatio…
Browse files Browse the repository at this point in the history
…n_propagation

Submission classification propagation
  • Loading branch information
cccs-sgaron authored May 5, 2020
2 parents 8f8a185 + 24d8ddb commit 75bee07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions assemblyline_ui/api/v4/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,10 @@ def recursive_flatten_tree(tree):
data.update(get_results(res_keys))
data.update(get_errors(err_keys))

for r in data['results']:
for r in data['results'].values():
data['classification'] = Classification.max_classification(data['classification'], r['classification'])

for f in data['file_infos']:
for f in data['file_infos'].values():
data['classification'] = Classification.max_classification(data['classification'], f['classification'])

return make_api_response(data)
Expand Down
6 changes: 5 additions & 1 deletion test/test_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def test_get_submission_tree(datastore, login_session):
submission = random.choice(datastore.submission.search("id:*", rows=NUM_SUBMISSIONS, as_obj=False)['items'])
resp = get_api_data(session, f"{host}/api/v4/submission/tree/{submission['sid']}/")
assert isinstance(resp, dict)
for k in resp:
assert "classification" in resp
assert "filtered" in resp
assert "tree" in resp

for k in resp['tree']:
assert len(k) == 64


Expand Down

0 comments on commit 75bee07

Please sign in to comment.