def test_request_required(self): with self.assertRaises(RequiredForCondition): path_condition("/my/path")
def test_path_condition_invalid(self): self.request.path = "/your/path" self.assertFalse(path_condition("/my/path", request=self.request))
def test_path_condition_valid_subpath(self): self.request.path = "/my/path/to/somewhere" self.assertTrue(path_condition("/my/path", request=self.request))
def test_path_condition_valid_not_starting_with(self): self.request.path = "/subsection/my/path" self.assertTrue(path_condition("/my/path", request=self.request))
def test_path_condition_valid_exact(self): self.request.path = "/my/path" self.assertTrue(path_condition("/my/path", request=self.request))