Skip to content

Commit

Permalink
Fix tests and a deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
gdubicki committed Jul 27, 2023
1 parent 0b8fd22 commit 5429f9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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 5429f9e

Please sign in to comment.