Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_delete.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from collections import defaultdict | from collections import defaultdict | ||||
from django.urls import reverse | from django.urls import reverse | ||||
from rest_framework import status | from rest_framework import status | ||||
from typing import Mapping | from typing import Dict, Mapping | ||||
from swh.deposit.config import ( | from swh.deposit.config import ( | ||||
EDIT_SE_IRI, EM_IRI, ARCHIVE_KEY, METADATA_KEY, | EDIT_SE_IRI, EM_IRI, ARCHIVE_KEY, METADATA_KEY, | ||||
DEPOSIT_STATUS_DEPOSITED | DEPOSIT_STATUS_DEPOSITED | ||||
) | ) | ||||
from swh.deposit.models import Deposit, DepositRequest | from swh.deposit.models import Deposit, DepositRequest | ||||
def count_deposit_request_types(deposit_requests) -> Mapping[str, int]: | def count_deposit_request_types(deposit_requests) -> Mapping[str, int]: | ||||
deposit_request_types = defaultdict(int) | deposit_request_types = defaultdict(int) # type: Dict[str, int] | ||||
for dr in deposit_requests: | for dr in deposit_requests: | ||||
deposit_request_types[dr.type] += 1 | deposit_request_types[dr.type] += 1 | ||||
return deposit_request_types | return deposit_request_types | ||||
def test_delete_archive_on_partial_deposit_works( | def test_delete_archive_on_partial_deposit_works( | ||||
authenticated_client, partial_deposit_with_metadata, | authenticated_client, partial_deposit_with_metadata, | ||||
deposit_collection): | deposit_collection): | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |