From the course: Secure Coding in Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Run the test, fix the code - Python Tutorial
From the course: Secure Coding in Python
Challenge: Run the test, fix the code
(upbeat music) - [Instructor] So our challenge here is to fix the regression picked up by this test. Let's clear the terminal and run it one more time. So clear, and here I am at 04/04/04/feed, and to run the test I'll type in pip and run pytest. Now, I'm told that at test post content, I have an extra value in the response JSON. So let's go over to the test where this is happening. So here I am at 04/04/feed, post, tests, tests.py. And you'll see that I've broken line 42 down into a few lines, just to keep things a little bit clearer. So you'll see what kind of JSON I expect here. At line 43, you'll see that author should be the author's username. On line 44, text should be, hey, followed by created, which should be the created date of the post, which is formatted to the correct format, which the API should return. Now, take a few minutes to see what caused this regression. What was changed since we last fixed this endpoint?…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.