Updating Forms to the new FlaskForm class name
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from flask.ext.wtf import Form
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import (
|
from wtforms import (
|
||||||
HiddenField, RadioField, SelectField,
|
HiddenField, RadioField, SelectField,
|
||||||
TextAreaField, BooleanField, validators
|
TextAreaField, BooleanField, validators
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class QueryForm(Form):
|
class QueryForm(FlaskForm):
|
||||||
"""The form used to allow freeform queries to be executed against
|
"""The form used to allow freeform queries to be executed against
|
||||||
PuppetDB."""
|
PuppetDB."""
|
||||||
query = TextAreaField('Query', [validators.Required(
|
query = TextAreaField('Query', [validators.Required(
|
||||||
@@ -30,7 +30,7 @@ class QueryForm(Form):
|
|||||||
rawjson = BooleanField('Raw JSON')
|
rawjson = BooleanField('Raw JSON')
|
||||||
|
|
||||||
|
|
||||||
class CatalogForm(Form):
|
class CatalogForm(FlaskForm):
|
||||||
"""The form used to compare the catalogs of different nodes."""
|
"""The form used to compare the catalogs of different nodes."""
|
||||||
compare = HiddenField('compare')
|
compare = HiddenField('compare')
|
||||||
against = SelectField('against')
|
against = SelectField('against')
|
||||||
|
|||||||
12
test/test_form.py
Normal file
12
test/test_form.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import pytest
|
||||||
|
from puppetboard import app, forms
|
||||||
|
|
||||||
|
|
||||||
|
def test_form_valid(capsys):
|
||||||
|
for form in [forms.QueryForm, forms.CatalogForm]:
|
||||||
|
with app.app.test_request_context():
|
||||||
|
qf = form()
|
||||||
|
out, err = capsys.readouterr()
|
||||||
|
assert qf is not None
|
||||||
|
assert err == ""
|
||||||
|
assert out == ""
|
||||||
Reference in New Issue
Block a user