Skip to content

Commit

Permalink
chg ! findings response (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitali-yanushchyk-valor authored Jan 16, 2025
1 parent a0b88dd commit 2cba530
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/admin/test_admin_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def extend(self, __iterable) -> None:

GLOBAL_EXCLUDED_MODELS = RegexList(
[
r"api\.Finding",
r"django_celery_beat\.ClockedSchedule",
r"contenttypes\.ContentType",
r"faces\.DummyModel",
Expand Down
14 changes: 5 additions & 9 deletions tests/extras/testutils/factories/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
IgnoredReferencePkPair,
Image,
)
from hope_dedup_engine.constants import FacialError


class TokenFactory(DjangoModelFactory):
Expand Down Expand Up @@ -67,22 +66,19 @@ class Meta:

deduplication_set = SubFactory(DeduplicationSetFactory)
first_reference_pk = fuzzy.FuzzyText()
first_filename = fuzzy.FuzzyText()
second_reference_pk = fuzzy.FuzzyText()
second_filename = fuzzy.FuzzyText()
score = fuzzy.FuzzyFloat(low=0, high=1)

@lazy_attribute
def error(self):
def status_code(self):
return (
fuzzy.FuzzyChoice(list(FacialError)).fuzz().value
fuzzy.FuzzyChoice(list(Image.StatusCode.values)).fuzz().value
if self.score == 0
else None
)

@lazy_attribute
def second_reference_pk(self):
if self.error is not None:
return FacialError(self.error).name
return fuzzy.FuzzyText()


class IgnoredFilenamePairFactory(DjangoModelFactory):
deduplication_set = SubFactory(DeduplicationSetFactory)
Expand Down

0 comments on commit 2cba530

Please sign in to comment.