Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/test_utils.py
# Copyright (C) 2018 The Software Heritage developers | # Copyright (C) 2018 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 | ||||
import unittest | import unittest | ||||
from swh.deposit import utils | from swh.deposit import utils | ||||
from swh.deposit.models import Deposit, DepositClient | |||||
def test_origin_url_from(): | |||||
for provider_url, external_id in ( | |||||
('http://somewhere.org', 'uuid'), | |||||
('http://overthejungle.org', 'diuu'), | |||||
): | |||||
deposit = Deposit( | |||||
client=DepositClient(provider_url=provider_url), | |||||
external_id=external_id | |||||
) | |||||
actual_origin_url = utils.origin_url_from(deposit) | |||||
assert actual_origin_url == '%s/%s' % ( | |||||
provider_url.rstrip('/'), external_id) | |||||
class UtilsTestCase(unittest.TestCase): | class UtilsTestCase(unittest.TestCase): | ||||
"""Utils library | """Utils library | ||||
""" | """ | ||||
def test_merge(self): | def test_merge(self): | ||||
"""Calling utils.merge on dicts should merge without losing information | """Calling utils.merge on dicts should merge without losing information | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |