Skip to content

Commit

Permalink
small unit test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtmccarty committed Dec 2, 2024
1 parent 5f14c2a commit 7202704
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/tests/unit/core/diff/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class EnrichedRelationshipGroupFactory(DataclassFactory[EnrichedDiffRelationship
num_conflicts = 0
nodes = set()
contains_conflict = False
is_managed = False


class EnrichedRelationshipElementFactory(DataclassFactory[EnrichedDiffSingleRelationship]):
Expand Down
6 changes: 5 additions & 1 deletion backend/tests/unit/core/diff/test_conflicts_enricher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random
from unittest.mock import AsyncMock
from uuid import uuid4

import pytest
Expand All @@ -7,6 +8,7 @@
from infrahub.core.constants import DiffAction, RelationshipCardinality
from infrahub.core.constants.database import DatabaseEdgeType
from infrahub.core.diff.conflicts_enricher import ConflictsEnricher
from infrahub.core.diff.managed_relationship_checker import ManagedRelationshipChecker
from infrahub.core.diff.model.path import EnrichedDiffConflict
from infrahub.core.initialization import create_branch
from infrahub.core.timestamp import Timestamp
Expand All @@ -31,7 +33,9 @@ def setup_method(self):
self.to_time = Timestamp()

async def __call_system_under_test(self, db: InfrahubDatabase, base_enriched_diff, branch_enriched_diff) -> None:
conflicts_enricher = ConflictsEnricher()
mock_rel_checker = AsyncMock(spec=ManagedRelationshipChecker)
mock_rel_checker.check.return_value = False
conflicts_enricher = ConflictsEnricher(managed_relationship_checker=mock_rel_checker)
return await conflicts_enricher.add_conflicts_to_branch_diff(
base_diff_root=base_enriched_diff, branch_diff_root=branch_enriched_diff
)
Expand Down

0 comments on commit 7202704

Please sign in to comment.