Skip to content

Commit becc783

Browse files
committed
WTForms 2.3.x test fixes
1 parent 1638c41 commit becc783

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

flask_admin/tests/geoa/test_basic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def test_model():
9898
rv = client.get(url)
9999
eq_(rv.status_code, 200)
100100
data = rv.data.decode('utf-8')
101-
ok_(r' name="multi">{"type":"MultiPoint","coordinates":[[100,0],[101,1]]}</textarea>' in data)
101+
ok_(r'{"type":"MultiPoint","coordinates":[[100,0],[101,1]]}</textarea>' in data or
102+
r'{&#34;type&#34;:&#34;MultiPoint&#34;,&#34;coordinates&#34;:[[100,0],[101,1]]}' in data)
102103

103104
# rv = client.post(url, data={
104105
# "name": "edited",
@@ -150,4 +151,6 @@ def test_none():
150151
rv = client.get(url)
151152
eq_(rv.status_code, 200)
152153
data = rv.data.decode('utf-8')
153-
ok_(r' name="point"></textarea>' in data)
154+
ok_(r' name="point"></textarea>' in data or
155+
' name="point">\n</textarea>' in data or
156+
' name="point">\r\n</textarea>' in data)

flask_admin/tests/mongoengine/test_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,8 @@ def test_ajax_fk():
10551055
ok_(u'value=""' not in form.model1())
10561056

10571057
form.model1.data = model
1058-
needle = u'data-json="[&quot;%s&quot;, &quot;first&quot;]"' % as_unicode(model.id)
1059-
ok_(needle in form.model1())
1058+
ok_(u'data-json="[&quot;%s&quot;, &quot;first&quot;]"' % as_unicode(model.id) in form.model1() or
1059+
u'data-json="[&#34;%s&#34;, &#34;first&#34;]"' % as_unicode(model.id) in form.model1())
10601060
ok_(u'value="%s"' % as_unicode(model.id) in form.model1())
10611061

10621062
# Check querying

flask_admin/tests/sqla/test_basic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,8 @@ def test_ajax_fk():
22732273
ok_(u'value=""' not in form.model1())
22742274

22752275
form.model1.data = model
2276-
ok_(u'data-json="[%s, &quot;first&quot;]"' % model.id in form.model1())
2276+
ok_(u'data-json="[%s, &quot;first&quot;]"' % model.id in form.model1() or
2277+
u'data-json="[%s, &#34;first&#34;]"' % model.id in form.model1())
22772278
ok_(u'value="1"' in form.model1())
22782279

22792280
# Check querying
@@ -2345,7 +2346,8 @@ class Model2(db.Model):
23452346
ok_(u'data-json="[]"' in form.model1())
23462347

23472348
form.model1.data = [model]
2348-
ok_(u'data-json="[[1, &quot;first&quot;]]"' in form.model1())
2349+
ok_(u'data-json="[[1, &quot;first&quot;]]"' in form.model1() or
2350+
u'data-json="[[1, &#34;first&#34;]]"' in form.model1())
23492351

23502352
# Check submitting
23512353
client = app.test_client()

flask_admin/tests/sqla/test_postgres.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class JSONModel(db.Model):
7575
eq_(rv.status_code, 200)
7676
data = rv.data.decode('utf-8')
7777
ok_('json_test' in data)
78-
ok_('>{"test_key1": "test_value1"}<' in data)
78+
ok_('>{"test_key1": "test_value1"}<' in data or
79+
'{&#34;test_key1&#34;: &#34;test_value1&#34;}<' in data)
7980

8081

8182
def test_citext():
@@ -111,4 +112,6 @@ class CITextModel(db.Model):
111112
eq_(rv.status_code, 200)
112113
data = rv.data.decode('utf-8')
113114
ok_('name="citext_test"' in data)
114-
ok_('>Foo<' in data)
115+
ok_('>Foo</' in data or
116+
'>\nFoo</' in data or
117+
'>\r\nFoo</' in data)

0 commit comments

Comments
 (0)