Page MenuHomeSoftware Heritage

D4204.id14866.diff
No OneTemporary

D4204.id14866.diff

diff --git a/swh/deposit/tests/cli/test_client.py b/swh/deposit/tests/cli/test_client.py
--- a/swh/deposit/tests/cli/test_client.py
+++ b/swh/deposit/tests/cli/test_client.py
@@ -23,6 +23,14 @@
}
+@pytest.fixture
+def deposit_config():
+ return {
+ "url": "https://deposit.swh.test/1",
+ "auth": {"username": "test", "password": "test",},
+ }
+
+
@pytest.fixture
def datadir(request):
"""Override default datadir to target main test datadir"""
@@ -81,12 +89,10 @@
assert "Service document retrieval: something went wrong" == str(e.value)
-def test_collection_ok():
- mock_client = MagicMock()
- mock_client.service_document.return_value = EXAMPLE_SERVICE_DOCUMENT
- collection_name = _collection(mock_client)
-
- assert collection_name == "softcol"
+def test_collection_ok(deposit_config, requests_mock_datadir):
+ client = PublicApiDepositClient(deposit_config)
+ collection_name = _collection(client)
+ assert collection_name == "test"
def test_collection_ko_because_downtime():
diff --git a/swh/deposit/tests/data/https_deposit.swh.test/1_servicedocument b/swh/deposit/tests/data/https_deposit.swh.test/1_servicedocument
new file mode 100644
--- /dev/null
+++ b/swh/deposit/tests/data/https_deposit.swh.test/1_servicedocument
@@ -0,0 +1,26 @@
+<?xml version="1.0" ?>
+<service xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:sword="http://purl.org/net/sword/terms/"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns="http://www.w3.org/2007/app">
+
+ <sword:version>2.0</sword:version>
+ <sword:maxUploadSize>209715200</sword:maxUploadSize>
+
+ <workspace>
+ <atom:title>The Software Heritage (SWH) Archive</atom:title>
+ <collection href="test">
+ <atom:title>test Software Collection</atom:title>
+ <accept>application/zip</accept>
+ <accept>application/x-tar</accept>
+ <sword:collectionPolicy>Collection Policy</sword:collectionPolicy>
+ <dcterms:abstract>Software Heritage Archive</dcterms:abstract>
+ <sword:treatment>Collect, Preserve, Share</sword:treatment>
+ <sword:mediation>false</sword:mediation>
+ <sword:metadataRelevantHeader>false</sword:metadataRelevantHeader>
+ <sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
+ <sword:service>https://deposit.swh.test/1/test/</sword:service>
+ <sword:name>test</sword:name>
+ </collection>
+ </workspace>
+</service>

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 24, 5:56 PM (5 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220484

Event Timeline