Skip to content

Commit 21c4ca7

Browse files
author
Matt Wright
committed
Adjust test for init_app
1 parent 85cdf6b commit 21c4ca7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ def test_api_base(self):
279279
def test_api_delayed_initialization(self):
280280
app = Flask(__name__)
281281
api = flask_restful.Api()
282+
api.add_resource(HelloWorld, '/', endpoint="hello")
282283
api.init_app(app)
284+
with app.test_client() as client:
285+
self.assertEquals(client.get('/').status_code, 200)
283286

284-
api.add_resource(HelloWorld, '/', endpoint="hello")
285287

286288

287289
def test_api_prefix(self):
@@ -660,15 +662,15 @@ def test_endpoints(self):
660662
with app.test_request_context('/ids/3'):
661663
self.assertTrue(api._has_fr_route())
662664

663-
665+
664666
def test_url_for(self):
665667
app = Flask(__name__)
666668
api = flask_restful.Api(app)
667669
api.add_resource(HelloWorld, '/ids/<int:id>')
668670
with app.test_request_context('/foo'):
669671
self.assertEqual(api.url_for(HelloWorld, id = 123), '/ids/123')
670672

671-
673+
672674
def test_fr_405(self):
673675
app = Flask(__name__)
674676
api = flask_restful.Api(app)

0 commit comments

Comments
 (0)