# SPDX-License-Identifier: AGPL-3.0-or-later # Repository tests # # This file is part of Hydrilla # # Copyright (C) 2021, 2022 Wojtek Kosior # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # # # I, Wojtek Kosior, thereby promise not to sue for violation of this # file's license. Although I request that you do not make use this code # in a proprietary program, I am not going to
aboutsummaryrefslogtreecommitdiff
path: root/nix/libutil
ModeNameSize
-rw-r--r--affinity.cc1112logplainabout
-rw-r--r--affinity.hh111logplainabout
-rw-r--r--archive.cc8431logplainabout
-rw-r--r--archive.hh1798logplainabout
-rw-r--r--hash.cc7536logplainabout
-rw-r--r--hash.hh2889logplainabout
-rw-r--r--serialise.cc6452logplainabout
-rw-r--r--serialise.hh3287logplainabout
-rw-r--r--types.hh2214logplainabout
-rw-r--r--util.cc29336logplainabout
-rw-r--r--util.hh9666logplainabout
sponse.status_code == 200 description = json.loads(response.data.decode()) assert description['source_name'] == 'hello' assert sorted([d['identifier'] for d in description['definitions']]) == \ ['hello-message', 'helloapple', 'helloapple'] zipfile_hash = description['source_archives']['zip']['sha256'] response = def_get(f'/source/hello.zip') assert sha256(response.data).digest().hex() == zipfile_hash hydrilla_util.validator_for('api_source_description-1.0.1.schema.json')\ .validate(description) def test_missing_source() -> None: """Verify requests for nonexistent sources result in 404.""" response = def_get(f'/source/nonexistent.json') assert response.status_code == 404 response = def_get(f'/source/nonexistent.zip') assert response.status_code == 404 def test_normalize_version(): assert hydrilla_util.normalize_version([4, 5, 3, 0, 0]) == [4, 5, 3] assert hydrilla_util.normalize_version([1, 0, 5, 0]) == [1, 0, 5] assert hydrilla_util.normalize_version([3, 3]) == [3, 3]