final tweak of keyfile
This commit is contained in:
parent
95150fa8e9
commit
e228e31b84
|
@ -7,14 +7,12 @@ python:
|
|||
- "3.8"
|
||||
- "nightly"
|
||||
- "pypy3.6-7.3.1"
|
||||
before_install: openssl enc -d -aes-256-ctr -pbkdf2 -k $KEY -in keyfile.toml.enc -out keyfile.toml
|
||||
install: pip install -U $DEPS pytest pytest-asyncio pytest-httpbin flaky structlog toml
|
||||
script: pytest
|
||||
env:
|
||||
global:
|
||||
# github
|
||||
- secure: "JNuxbHbO+Qj88r0So+FKp8GBVmobGlBNi0hkZIyOH4cBXtuiM1Jo6FtRYInfTUH5TcgfMQml1a8p9g8n1fbRcTsxPt3kkT0ZleW1fJNudOHJFOmDooM4gC2/A+6aMl3xdnLCQ9cXxqsXjIUBie3GhqC4ufInU7VshxOn7KZADbI3zDuLuw9gdsBQf/OADY4oO3y1URxdnWjssP8pwfDFRSEkuLKNDtsYrhkmp3jRAq5DMtMXTEyHly9CJHow7yMyoBHa6Q/J7+C57pI4JsO8c0nJWy/wQUnqw9EeLE/9gAHY1sHlEpjZtJrV45kRd+KC6x4FtoFjvngxymK2A0zmecBI3DRTWBAZedPPVatAD9nlDmwAacBtwvuZJkt6fMUBWMY1I1NEiwdYxceBiqrnvU48FfNOylXE6KuarCQZik/VWk8olIQjXIukMu8EQ58pnEuLZB7wbwNzMLheomuVMEK1nfLOltKaytztl/7cKlsx6SmxY5rQI/x7QInd+rq9OxDDwCo+jEofPKvAcCbUJj6SqfB7QAUxJwwD/ER4/Bji9KSz3BoCu+x7h/ILcskNqLlg4LDCcpxqMOyxePk7A30sSop1E5YLWo0lmS9s88mEz89tzCWSDVIzwQrdMghNBe6JFMzOoKDRDhEkMrs3MAK+FUJkbteGhHrdC86EidU="
|
||||
# gitlab
|
||||
- secure: "DjtWOVNYGGWQ9SHOrfqbh7SVm9DHOSUCYcgDmzIpSCbbFJq5wXAiuHwm8LBUOmjYVV73/pY01sSL7Ud/hO61WMXt3be++XHtEqaCTw9HXJzvn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0KDnl8qsX7O2ULX+E76CjCgdq7SM37tilhXbjH4bX/aaFpncOMWqw5YgpgYo9XIPZeiXIE8fjv/Eu1Ahxh7rv+bqP4SAICknRVIaLrzpVN3wYHMlDi93GoBisREe7nI78wvZxebI0NV+qvTII0Hak+hUJtDM6ujg/ZkqiEfppw9NonmHSgmQcE="
|
||||
jobs:
|
||||
- DEPS=aiohttp
|
||||
- DEPS="tornado pycurl"
|
||||
|
|
Binary file not shown.
|
@ -30,7 +30,7 @@ async def get_version(
|
|||
token = conf.get('token')
|
||||
# Load token from keyman
|
||||
if token is None:
|
||||
key_name = 'gitea_' + host.lower().replace('.', '_').replace("/", "_")
|
||||
key_name = 'gitea_' + host.lower()
|
||||
token = keymanager.get_key(key_name)
|
||||
|
||||
# Set private token if token exists.
|
||||
|
|
|
@ -13,13 +13,15 @@ from nvchecker import core
|
|||
from nvchecker import __main__ as main
|
||||
from nvchecker.util import Entries, VersData, RawResult
|
||||
|
||||
use_keyfile = False
|
||||
|
||||
async def run(
|
||||
entries: Entries, max_concurrency: int = 20,
|
||||
) -> VersData:
|
||||
token_q = core.token_queue(max_concurrency)
|
||||
result_q: asyncio.Queue[RawResult] = asyncio.Queue()
|
||||
keyfile = os.environ.get('KEYFILE')
|
||||
if keyfile:
|
||||
if use_keyfile and keyfile:
|
||||
filepath = Path(keyfile)
|
||||
keymanager = core.KeyManager(filepath)
|
||||
else:
|
||||
|
@ -89,3 +91,14 @@ def pytest_configure(config):
|
|||
config.addinivalue_line(
|
||||
'markers', 'needs_net: mark test to require Internet access',
|
||||
)
|
||||
|
||||
@pytest.fixture
|
||||
def keyfile():
|
||||
global use_keyfile
|
||||
if 'KEYFILE' not in os.environ:
|
||||
pytest.skip('KEYFILE not set')
|
||||
return
|
||||
|
||||
use_keyfile = True
|
||||
yield
|
||||
use_keyfile = False
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [pytest.mark.asyncio,
|
||||
pytest.mark.needs_net,
|
||||
pytest.mark.skipif("KEYFILE" not in os.environ,
|
||||
reason="requires KEYFILE, or it fails too much")]
|
||||
pytest.mark.usefixtures('keyfile')]
|
||||
|
||||
async def test_github(get_version):
|
||||
assert await get_version("example", {
|
||||
|
|
Loading…
Reference in New Issue