1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# SPDX-License-Identifier: AGPL-3.0-or-later
# Repository tests
#
# This file is part of Hydrilla
#
# Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
#
#
# 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 enforce this in court.
import pytest
import sys
import shutil
from pathlib import Path
from os import mkdir, unlink, environ
import json
import pydrilla
test_dir = Path(__file__).resolve().parent
pydrilla_dir = Path(hydrilla.__file__).resolve().parent
test_config_path = test_dir / 'config.json'
@pytest.fixture
def client():
app = pydrilla.create_app(test_config_path, flask_config={'TESTING': True})
with app.test_client() as client:
yield client
def test_basic(client):
response = client.get('/')
assert b'html' in response.data
def test_normalize_version():
assert pydrilla.normalize_version([4, 5, 3, 0, 0]) == [4, 5, 3]
assert pydrilla.normalize_version([1, 0, 5, 0]) == [1, 0, 5]
assert pydrilla.normalize_version([3, 3]) == [3, 3]
|