I am trying to test the /auth endpoint in a Flask application that uses the Flask-JWT module.
import json
import pytest
@pytest.mark.usefixtures("testapp")
class TestURLs:
def test_auth(self, testapp):
rv = testapp.get('/auth',
data=json.dumps({'username':'bob', 'password': 'pw'}),
content_type='application/json')
... test assertion ...
The /auth endpoint functions perfectly when I am running a flask server and I can request JWT tokens.
But when the test is run, it receives this response from the server.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
Is there a way to configure the test fixture to recognise the /auth endpoint?