Skip to content

Commit

Permalink
Add unit test for artefact metadata id calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
8R0WNI3 committed Dec 2, 2024
1 parent bb38624 commit 0e31eee
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Empty file added test/dso/__init__.py
Empty file.
46 changes: 46 additions & 0 deletions test/dso/model_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import dso.model


def test_artefact_metadata_id():
artefact_metadatum_1 = dso.model.ArtefactMetadata(
artefact=dso.model.ComponentArtefactId(
component_name='my-component',
component_version=None,
artefact_kind=dso.model.ArtefactKind.RESOURCE,
artefact=dso.model.LocalArtefactId(
artefact_name='my-artefact',
artefact_version='0.1.0',
artefact_type='my-artefact-type',
artefact_extra_id={
'extra-identity-key-1': 'extra-identity-value-1',
'extra-identity-key-2': 'extra-identity-value-2',
},
),
),
meta=dso.model.Metadata(
datasource='my-datasource',
type='my-type',
),
data={},
)

artefact_metadatum_2 = dso.model.ArtefactMetadata(
artefact=dso.model.ComponentArtefactId(
component_name='my-component',
component_version='0.1.0',
artefact=dso.model.LocalArtefactId(
artefact_name='my-artefact',
artefact_version='0.1.0',
artefact_type='my-artefact-type',
),
references=[artefact_metadatum_1.artefact],
),
meta=dso.model.Metadata(
datasource='my-datasource',
type='my-type',
),
data={},
)

assert artefact_metadatum_1.id == 'de25c7bf37c6031b6d38ef14288b0e2b'
assert artefact_metadatum_2.id == 'e7645c972e93cdf01526df135253584d'

0 comments on commit 0e31eee

Please sign in to comment.