Skip to content
Snippets Groups Projects
Commit eb2631a7 authored by vlorentz's avatar vlorentz
Browse files

Make the atom_dataset fixture available to all tests.

parent 0c1a59c9
No related branches found
No related tags found
No related merge requests found
Showing
with 24 additions and 24 deletions
......@@ -7,8 +7,6 @@ import hashlib
import pytest
from django.urls import reverse
from os import path, listdir
from typing import Mapping
from swh.deposit.config import (
DEPOSIT_STATUS_DEPOSITED, COL_IRI, DEPOSIT_STATUS_VERIFIED
......@@ -19,28 +17,6 @@ from swh.deposit.parsers import parse_xml
from swh.deposit.api.private.deposit_check import SWHChecksDeposit
@pytest.fixture
def atom_dataset(datadir) -> Mapping[str, bytes]:
"""Compute the paths to atom files.
Returns:
Dict of atom name per content (bytes)
"""
atom_path = path.join(datadir, 'atom')
data = {}
for filename in listdir(atom_path):
filepath = path.join(atom_path, filename)
with open(filepath, 'rb') as f:
raw_content = f.read()
# Keep the filename without extension
atom_name = filename.split('.')[0]
data[atom_name] = raw_content
return data
@pytest.fixture
def ready_deposit_ok(partial_deposit_with_metadata):
"""Returns a deposit ready for checks (it will pass the checks).
......
../../data/atom
\ No newline at end of file
../../data/atom
\ No newline at end of file
......@@ -163,6 +163,28 @@ def sample_archive(tmp_path):
return archive
@pytest.fixture
def atom_dataset(datadir) -> Mapping[str, bytes]:
"""Compute the paths to atom files.
Returns:
Dict of atom name per content (bytes)
"""
atom_path = os.path.join(datadir, 'atom')
data = {}
for filename in os.listdir(atom_path):
filepath = os.path.join(atom_path, filename)
with open(filepath, 'rb') as f:
raw_content = f.read()
# Keep the filename without extension
atom_name = filename.split('.')[0]
data[atom_name] = raw_content
return data
def create_deposit(
authenticated_client, collection_name: str, sample_archive,
external_id: str, deposit_status=DEPOSIT_STATUS_DEPOSITED):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment