Skip to content

Commit

Permalink
Fix integration tests by making the mime-types field a set in Bytes a…
Browse files Browse the repository at this point in the history
…s well

Signed-off-by: Donny Peeters <[email protected]>
  • Loading branch information
Donnype committed Sep 5, 2024
1 parent 0e1cd58 commit 2056796
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bytes/bytes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RawDataMeta(BaseModel):

id: UUID
boefje_meta: BoefjeMeta
mime_types: list[MimeType] = Field(default_factory=list)
mime_types: set[MimeType] = Field(default_factory=set)

# These are set once the raw is saved
secure_hash: SecureHash | None = None
Expand All @@ -83,7 +83,7 @@ class RawDataMeta(BaseModel):
class RawData(BaseModel):
value: bytes
boefje_meta: BoefjeMeta
mime_types: list[MimeType] = Field(default_factory=list)
mime_types: set[MimeType] = Field(default_factory=set)

# These are set once the raw is saved
secure_hash: SecureHash | None = None
Expand Down
2 changes: 1 addition & 1 deletion bytes/tests/integration/test_bytes_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_normalizer_meta(bytes_api_client: BytesAPIClient, event_manager: Rabbit
normalizer_meta.raw_data.hash_retrieval_link = retrieved_normalizer_meta.raw_data.hash_retrieval_link
normalizer_meta.raw_data.signing_provider_url = retrieved_normalizer_meta.raw_data.signing_provider_url

assert normalizer_meta.dict() == retrieved_normalizer_meta.dict()
assert normalizer_meta.model_dump_json() == retrieved_normalizer_meta.model_dump_json()


def test_filtered_normalizer_meta(bytes_api_client: BytesAPIClient) -> None:
Expand Down
6 changes: 3 additions & 3 deletions bytes/tests/integration/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ def test_clean_mime_types(meta_repository: SQLMetaDataRepository) -> None:
meta_repository.save_boefje_meta(boefje_meta)

raw = get_raw_data()
raw.mime_types.append(MimeType(value=raw.boefje_meta.boefje.id))
raw.mime_types.add(MimeType(value=raw.boefje_meta.boefje.id))
raw_id_1 = meta_repository.save_raw(raw)

raw.mime_types.append(
raw.mime_types.add(
MimeType(value=f"boefje/{raw.boefje_meta.boefje.id}-ce293f79fd3c809a300a2837bb1da4f7115fc034a1f78")
)
raw_id_2 = meta_repository.save_raw(raw)

raw.mime_types.append(
raw.mime_types.add(
MimeType(value=f"boefje/{raw.boefje_meta.boefje.id}-ba293f79fd3c809a300a2837bb1da4f7115fc034a1f78")
)
raw_id_3 = meta_repository.save_raw(raw)
Expand Down

0 comments on commit 2056796

Please sign in to comment.