Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/debian/tests/test_debian.py
# Copyright (C) 2019-2021 The Software Heritage developers | # Copyright (C) 2019-2021 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 copy import deepcopy | ||||||||||||||
import logging | import logging | |||||||||||||
from os import path | from os import path | |||||||||||||
import pytest | import pytest | |||||||||||||
from swh.loader.package.debian.loader import ( | from swh.loader.package.debian.loader import ( | |||||||||||||
DebianLoader, | DebianLoader, | |||||||||||||
DebianPackageChangelog, | DebianPackageChangelog, | |||||||||||||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | def test_debian_dsc_information_not_found(): | |||||||||||||
p_info.files.pop(fname) | p_info.files.pop(fname) | |||||||||||||
dsc_url, dsc_name = dsc_information(p_info) | dsc_url, dsc_name = dsc_information(p_info) | |||||||||||||
assert dsc_url is None | assert dsc_url is None | |||||||||||||
assert dsc_name is None | assert dsc_name is None | |||||||||||||
def test_debian_dsc_information_missing_md5sum(): | ||||||||||||||
package_files = deepcopy(PACKAGE_FILES) | ||||||||||||||
for package_metadata in package_files["files"].values(): | ||||||||||||||
del package_metadata["md5sum"] | ||||||||||||||
p_info = DebianPackageInfo.from_metadata(package_files, url=URL) | ||||||||||||||
for debian_file_metadata in p_info.files.values(): | ||||||||||||||
ardumontUnsubmitted Not Done Inline Actions
ardumont: | ||||||||||||||
Done Inline Actionsthanks ! anlambert: thanks ! | ||||||||||||||
assert not debian_file_metadata.md5sum | ||||||||||||||
def test_debian_dsc_information_too_many_dsc_entries(): | def test_debian_dsc_information_too_many_dsc_entries(): | |||||||||||||
# craft an extra dsc file | # craft an extra dsc file | |||||||||||||
fname = "cicero_0.7.2-3.dsc" | fname = "cicero_0.7.2-3.dsc" | |||||||||||||
p_info = DebianPackageInfo.from_metadata(PACKAGE_FILES, url=URL) | p_info = DebianPackageInfo.from_metadata(PACKAGE_FILES, url=URL) | |||||||||||||
data = p_info.files[fname] | data = p_info.files[fname] | |||||||||||||
fname2 = fname.replace("cicero", "ciceroo") | fname2 = fname.replace("cicero", "ciceroo") | |||||||||||||
p_info.files[fname2] = data | p_info.files[fname2] = data | |||||||||||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |