Skip to content

Commit

Permalink
Merge pull request #49 from hCaptcha/feature/48
Browse files Browse the repository at this point in the history
Generate unite job_id for manifest in pydantic models
  • Loading branch information
rodriguez-facundo authored Mar 29, 2021
2 parents a21129c + 5c35856 commit da99984
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion basemodels/pydantic/manifest/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Manifest(Model):
job_api_key: Optional[UUID]

# We will set a default dynamic value for job_id
job_id: UUID = uuid4()
job_id: UUID = Field(default_factory=uuid4)

job_total_tasks: int
multi_challenge_manifests: Optional[List[NestedManifest]]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hmt-basemodels"
version = "0.1.2"
version = "0.1.3"
description = ""
authors = ["Intuition Machines, Inc <[email protected]>"]
packages = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="hmt-basemodels",
version="0.1.2",
version="0.1.3",
author="HUMAN Protocol",
description="Common data models shared by various components of the Human Protocol stack",
url="https://github.com/hCaptcha/hmt-basemodels",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ def test_example_err(self):

def test_working(self):
Manifest.parse_obj(self.m)

def test_unique_id(self):
m1 = deepcopy(SIMPLE)
m2 = deepcopy(SIMPLE)
self.assertNotEqual(str(Manifest(**m1).job_id), str(Manifest(**m2).job_id))

0 comments on commit da99984

Please sign in to comment.