The aim of this video is to present how we can test different routes using the Flask test client.
- [Instructor] Hi and welcome to the second video…of the sixth section: Testing Custom Flask Routes.…In the previous video, we looked at the Flask test client…and how our test built up in Flask.…In this video, we are going to take a look at:…how we can test the custom routes…which we have defined earlier, using the Flask Desk Client.…Then, we will review the code and draw some tests.…Let's start with opening of the test route,…the PY5 and we should take a look…at the test api candidate okay method.…As we can see, the name of the method starts…with a test keyword.…
So, the testing client knows this is a test…and it will execute it when all the tests are running.…For the Flask Desk Client, we have the get method,…which does an http get press towards the user,…which we want to test.…In the response, we had to date the property,…which contains the body of the response.…In case of an api request, this contains the string json…which comes from the server.…We need to pause this with the json library.…At the end of the method, we have a check done…
Regardless of platform, you will need to build APIs to serve data between different client applications and endpoints. Good APIs are a necessity for web and mobile projects, especially with the modern, mobile-first approach to development. This course delivers the fundamental knowledge required to enable highly connected interactions between applications via RESTful web APIs. Follow along with Gergo Bogdan and learn how to build up and structure an effective web API that can be used by any client application accessing it over HTTP, using Flask, the Python microframework.
Find out how to implement CRUD operations using SQLAlchemy and MySQL as the data store. Get an understanding of how REST works relative to APIs, and learn how to test APIs written in Python with the support of Flask. Explore token-based authentication and find out how to store passwords securely in your database. Along the way, Gergo introduces best practices and design guidelines when building large applications.
- Setting up Flask
- Using Flask templates and routing
- Implementing CRUD operations
- Implementing pagination
- Configuring RESTful authentication
- HTTP caching
- Securing web APIs
- Testing the application