Skip to content

Commit

Permalink
Merge pull request #57 from CybercentreCanada/feature/safelist_signat…
Browse files Browse the repository at this point in the history
…ures

Fix tests
  • Loading branch information
cccs-sgaron authored Aug 31, 2021
2 parents 2b5ced1 + 28b5699 commit 390149d
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions test/test_srv_safelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ def test_safelist_missing(client, storage):

# noinspection PyUnusedLocal
def test_get_full_safelist(client, storage):
storage.safelist.search = {
"offset": 0,
"rows": 0,
"total": 0,
"items": []
}
storage.safelist.stream_search.return_value = []

resp = client.get('/api/v1/safelist/', headers=headers)
assert resp.status_code == 200
Expand All @@ -73,12 +68,7 @@ def test_get_full_safelist(client, storage):

# noinspection PyUnusedLocal
def test_get_full_safelist_specific(client, storage):
storage.safelist.search = {
"offset": 0,
"rows": 0,
"total": 0,
"items": []
}
storage.safelist.stream_search.return_value = []

tag_type = "network.dynamic.domain"
resp = client.get(f'/api/v1/safelist/?tags={tag_type}', headers=headers)
Expand All @@ -97,14 +87,9 @@ def test_get_full_safelist_specific(client, storage):

# noinspection PyUnusedLocal
def test_get_signature_safelist(client, storage):
storage.safelist.search = {
"offset": 0,
"rows": 1,
"total": 1,
"items": [{"signature": {"name": "test"}}]
}

resp = client.get('/api/v1/safelist/signature/', headers=headers)
storage.safelist.stream_search.return_value = [{"signature": {"name": "test"}}]

resp = client.get('/api/v1/safelist/signatures/', headers=headers)
assert resp.status_code == 200
assert isinstance(resp.json['api_response'], list)
assert resp.json['api_response'] == ['test']

0 comments on commit 390149d

Please sign in to comment.