Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/metadata_dictionary/test_nuget.py
- This file was added.
# Copyright (C) 2022 The Software Heritage developers | |||||
# See the AUTHORS file at the top-level directory of this distribution | |||||
# License: GNU General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
from swh.indexer.metadata_dictionary import MAPPINGS | |||||
def test_compute_metadata_nuget(): | |||||
raw_content = b""" | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<package xmlns="http://package.example.org/"> | |||||
vlorentz: please use the right namespace | |||||
Done Inline ActionsSorry, didn't understand what you mean. Could you help me? What is a namespace? found some definitions on google but didn't understand what to change here. VickyMerzOwn: Sorry, didn't understand what you mean. Could you help me? What is a namespace? found some… | |||||
Done Inline Actionshttps://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course You replaced the namespace used by nuspec with http://package.example.org/, which changes the meaning of every tag in the file. vlorentz: https://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course
You replaced the… | |||||
<metadata> | |||||
<id>sample</id> | |||||
<version>1.2.3</version> | |||||
<authors>Kim Abercrombie, Franck Halmaert</authors> | |||||
<description>Sample exists only to show a sample .nuspec file.</description> | |||||
<language>en-US</language> | |||||
<projectUrl>http://example.org/</projectUrl> | |||||
<repository type="git" url="https://github.com/NuGet/NuGet.Client.git"/> | |||||
<license type="expression">MIT</license> | |||||
<dependencies> | |||||
<dependency id="another-package" version="3.0.0" /> | |||||
<dependency id="yet-another-package" version="1.0.0" /> | |||||
</dependencies> | |||||
</metadata> | |||||
<files> | |||||
<file src="bin\\Debug\\*.dll" target="lib" /> | |||||
</files> | |||||
</package>""" | |||||
result = MAPPINGS["NuGetMapping"]().translate(raw_content) | |||||
expected = { | |||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | |||||
"type": "SoftwareSourceCode", | |||||
"author": [ | |||||
{"type": "Person", "name": "Kim Abercrombie"}, | |||||
{"type": "Person", "name": "Franck Halmaert"}, | |||||
], | |||||
"codeRepository": "https://github.com/NuGet/NuGet.Client.git", | |||||
"description": "Sample exists only to show a sample .nuspec file.", | |||||
"license": "https://spdx.org/licenses/MIT", | |||||
"url": "http://example.org/", | |||||
"version": "1.2.3", | |||||
} | |||||
assert result == expected |
please use the right namespace