def test_splitting_path_without_query(self): path1 = "/test/test" self.assertEqual(("test/test", ""), split_request_string(path1)) path2 = "test/test" self.assertEqual(("test/test", ""), split_request_string(path2)) path3 = "test/test/" self.assertEqual(("test/test", ""), split_request_string(path3)) path4 = "test/test/{test}" self.assertEqual(("test/test/{test}", ""), split_request_string(path4))
def test_splitting_path(self): path1 = "/test?test=test&q={id}" self.assertEqual(("test", "test=test&q={id}"), split_request_string(path1)) path2 = "test?test=test&q={id}" self.assertEqual(("test", "test=test&q={id}"), split_request_string(path2)) path3 = "test/test?test=test&q={id}" self.assertEqual(("test/test", "test=test&q={id}"), split_request_string(path3)) path3 = "test/test?" self.assertEqual(("test/test", ""), split_request_string(path3))
def test_splitting_path_containing_spaces(self): path1 = "lkjlk lkjl" path2 = "a\tb" path3 = "a\r" with self.assertRaises(ValueError): split_request_string(path1) with self.assertRaises(ValueError): split_request_string(path2) with self.assertRaises(ValueError): split_request_string(path3)
def test_splitting_empty_path(self): path1 = None path2 = "" path3 = " " with self.assertRaises(ValueError): split_request_string(path1) with self.assertRaises(ValueError): split_request_string(path2) with self.assertRaises(ValueError): split_request_string(path3)
def test_splitting_path_only_with_query(self): path1 = "?test=test&q={id}" self.assertEqual(("", "test=test&q={id}"), split_request_string(path1)) path2 = "?" self.assertEqual(("", ""), split_request_string(path2))