Skip to content

Commit

Permalink
Fix tests and update a deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
gdubicki committed Jul 27, 2023
1 parent b83344a commit 80d9008
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion puppetboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
running_as = os.path.basename(sys.argv[0])
if not is_a_test():
check_db_version(puppetdb)
check_secret_key(app.config.get('SECRET_KEY'))
check_secret_key(app.config.get('SECRET_KEY'))

logging.basicConfig(level=app.config['LOGLEVEL'].upper())
log = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions puppetboard/core.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import re
import socket
from importlib.metadata import version

import pkg_resources
from flask import Flask
from flask_caching import Cache
from flask_apscheduler import APScheduler
Expand Down Expand Up @@ -70,7 +70,7 @@ def get_puppetdb():
timeout=app.config['PUPPETDB_TIMEOUT'],
protocol=app.config['PUPPETDB_PROTO'], )

requests_version = pkg_resources.get_distribution("requests").version
requests_version = version("requests")
user_agent_header = {
"user-agent": f"puppetboard/{own_version} (r/{requests_version})",
}
Expand Down
8 changes: 6 additions & 2 deletions test/test_form.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from puppetboard import app, forms
from puppetboard import forms
from puppetboard.core import get_app

app = get_app()
app.config['SECRET_KEY'] = 'the random string'


def test_form_valid(capsys):
for form in [forms.QueryForm]:
with app.app.test_request_context():
with app.test_request_context():
qf = form()
out, err = capsys.readouterr()
assert qf is not None
Expand Down

0 comments on commit 80d9008

Please sign in to comment.