question 468 Secure Python · hard
Test the path guard
safe_join(base, name) guards every download: it returns the resolved path of name inside base, and raises ValueError when the result would be outside base. Write unittest tests (or test_ functions) that pass for a correct guard and catch broken ones. Leave the calls to Check: don't run the tests yourself.
Target
safe_join(base, name) → resolved Path inside base, or ValueErrorYour testsa
unittest.TestCase class or test_ functions in your file; the starter's guard is correct, so your tests should pass on itGradedyour tests must pass for a correct guard and fail for each of three broken guards