Test the rules, not the framework. Django's ORM works. Its authentication works. Testing that Post.objects.create creates a post tests Django, not your application.
Test your rules: that a draft is not public, that the permission check is in place, that your custom validation rejects what it should.
◈ Graded Challenge
Write run_cases(rule, cases) modeling what parametrize does. rule is a function taking one value and returning True or False. cases is a list of pairs, each an input and the expected result. Return a list describing every case that disagreed, as strings shaped "input: expected X got Y" using True and False, in the order given. Return an empty list when every case agrees.
Name it exactly: run_cases(rule, cases)
Python2 visible + 4 hidden
loading editor…
Mark this lesson complete
Signed in, your progress follows you to every device.