def test_get_redirect_with_old_path(self): """Return redirect with given old_path if it exists, None if not.""" rd1 = Redirect('/one', '/two', 302) rd2 = Redirect('/three', '/four', 302) rdf = RedirectsFile('/tmp/foo.json') rdf.add_redirect(rd1) rdf.add_redirect(rd2) retrd = rdf.get_redirect_with_old_path('/three') assert retrd == rd2 retrd = rdf.get_redirect_with_old_path('/two') assert retrd is None retrd = rdf.get_redirect_with_old_path('/four') assert retrd is None