pypiserver/tests/test_init.py
PelleK 8101cf9192
Run black on codebase (#336)
* run black on codebase

* add black check to travis ci

* add pyproject.toml, revert black on bottle.py

Co-authored-by: Pelle Koster <pelle.koster@nginfra.nl>
2020-10-05 21:04:22 -05:00

57 lines
1.2 KiB
Python

"""
Test module for . . .
"""
# Standard library imports
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
import logging
from os.path import abspath, dirname, join, realpath
from sys import path
# Third party imports
import pytest
# Local imports
logger = logging.getLogger(__name__)
test_dir = realpath(dirname(__file__))
src_dir = abspath(join(test_dir, ".."))
path.append(src_dir)
print(path)
import pypiserver
@pytest.mark.parametrize(
"conf_options",
[
{},
{"root": "~/stable_packages"},
{
"root": "~/unstable_packages",
"authenticated": "upload",
"passwords": "~/htpasswd",
},
# Verify that the strip parser works properly.
{"authenticated": str("upload")},
],
)
def test_paste_app_factory(conf_options, monkeypatch):
"""Test the paste_app_factory method"""
monkeypatch.setattr(
"pypiserver.core.configure", lambda **x: (x, [x.keys()])
)
pypiserver.paste_app_factory({}, **conf_options)
def test_app_factory(monkeypatch):
monkeypatch.setattr(
"pypiserver.core.configure", lambda **x: (x, [x.keys()])
)
assert pypiserver.app() is not pypiserver.app()