Browse Source

look for json module in the right place. all tests

now pass with the new module layout
pull/112/head
Justin Quick 15 years ago
parent
commit
1a69c7d4bf
  1. 6
      tests/flask_tests.py

6
tests/flask_tests.py

@ -21,7 +21,7 @@ from contextlib import contextmanager
from datetime import datetime from datetime import datetime
from werkzeug import parse_date, parse_options_header from werkzeug import parse_date, parse_options_header
from cStringIO import StringIO from cStringIO import StringIO
from flask.helpers import json
example_path = os.path.join(os.path.dirname(__file__), '..', 'examples') example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')
sys.path.append(os.path.join(example_path, 'flaskr')) sys.path.append(os.path.join(example_path, 'flaskr'))
@ -409,7 +409,7 @@ class JSONTestCase(unittest.TestCase):
for url in '/kw', '/dict': for url in '/kw', '/dict':
rv = c.get(url) rv = c.get(url)
assert rv.mimetype == 'application/json' assert rv.mimetype == 'application/json'
assert flask.json.loads(rv.data) == d assert json.loads(rv.data) == d
def test_json_attr(self): def test_json_attr(self):
app = flask.Flask(__name__) app = flask.Flask(__name__)
@ -417,7 +417,7 @@ class JSONTestCase(unittest.TestCase):
def add(): def add():
return unicode(flask.request.json['a'] + flask.request.json['b']) return unicode(flask.request.json['a'] + flask.request.json['b'])
c = app.test_client() c = app.test_client()
rv = c.post('/add', data=flask.json.dumps({'a': 1, 'b': 2}), rv = c.post('/add', data=json.dumps({'a': 1, 'b': 2}),
content_type='application/json') content_type='application/json')
assert rv.data == '3' assert rv.data == '3'

Loading…
Cancel
Save