Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop committed Oct 28, 2023
1 parent 271f28b commit 69f5cfc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/web/apiv2/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ async def match(request: AnalysisRequest) -> AnalysisResponse:
processed_relationships = set()

if request.fetch_neighbors:
vertices, edges, _ = db_observable.neighbors()
# Get neighboring entities and relationships.
for edge in edges:
vertices, paths, _ = db_observable.neighbors()
for path in paths:
edge = path[0] # neighbors only returns 1 hop max by default
if edge.id in processed_relationships:
continue

Expand Down
2 changes: 1 addition & 1 deletion tests/apiv2/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_get_neighbors_tag(self):
data = response.json()
self.assertEqual(response.status_code, 200, data)
self.assertEqual(len(data["vertices"]), 2)
self.assertEqual(data["total"], 2)
self.assertEqual(data["total"], 1)

self.assertIn(self.entity1.extended_id, data["vertices"])

Expand Down
4 changes: 2 additions & 2 deletions tests/apiv2/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def test_tag_observable(self):
tag_relationships = data["tags"][f'observables/{observable_id}']
self.assertEqual(len(tag_relationships), 2, data)
self.assertIn("tag1", tag_relationships)
self.assertEquals(tag_relationships["tag1"]["source"], f'observables/{observable_id}')
self.assertEqual(tag_relationships["tag1"]["source"], f'observables/{observable_id}')
self.assertIn("tag2", tag_relationships)
self.assertEquals(tag_relationships["tag2"]["source"], f'observables/{observable_id}')
self.assertEqual(tag_relationships["tag2"]["source"], f'observables/{observable_id}')

response = client.post(
f"/api/v2/tags/search", json={"name": "tag1", "count": 1, "page": 0}
Expand Down

0 comments on commit 69f5cfc

Please sign in to comment.