From the course: Secure Coding in Python

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Challenge: Run the test, fix the code

Challenge: Run the test, fix the code - Python Tutorial

From the course: Secure Coding in Python

Challenge: Run the test, fix the code

It's time for a challenge. And in this one, I want you to secure the endpoint in our application by running the tests, there will be a regression, and you will modify the code in order to fix this regression. Let me show you what I mean. So here I am in 05_04 post, tests, tests, and I'm going to go ahead and cd into this as well. So cd 05_04/feed. And I'm going to go ahead and run these tests. So pipenv run pytest. And I want an extra verbose response. So I'll do -v. And it looks like there's a failure here. So the assertion was expecting one type of response, which is this one. But it got this one right here. So I want you to go ahead and fix this. Now, remember that serializing is a way to control what gets exposed and what doesn't in an API. So go ahead and take about 10 to 15 minutes to complete this task, and I'll see you in the next video.

Contents