def test_multiple_params_trailing_slash_parses(self): parser = UrlParamParser("/fake_route/{resource}/{action}") self.assertEqual( {"resource": "moe", "action": "smile"}, parser.resolve_params("/fake_route/moe/smile/"), )
def test_one_param_trailing_slash_parses(self): parser = UrlParamParser("/fake_route/{resource}") self.assertEqual(parser.resolve_params("/fake_route/moe/"), {"resource": "moe"})
def test_one_param_no_match_trailing_slash_does_not_parse(self): parser = UrlParamParser("/fake_route/{resource}") self.assertEqual(parser.resolve_params("/not_the_same_route/moe/"), {})
def test_no_params_no_match_trailing_slash_does_not_parse(self): parser = UrlParamParser("/fake_route") self.assertEqual({}, parser.resolve_params("/not_the_same_route/"))
def test_no_params_trailing_slash_parses(self): parser = UrlParamParser("/fake_route") self.assertEqual({}, parser.resolve_params("/fake_route/"))
def test_no_parms_parses(self): parser = UrlParamParser("/fake_route") self.assertEqual({}, parser.resolve_params("/fake_route"))
def test_missing_params_too_long_does_not_parse(self): parser = UrlParamParser("/fake_route/{resource}/{action}") self.assertEqual({}, parser.resolve_params("/fake_route/moe/test/extra"))
def test_multiple_params_no_match_trailing_slash_does_not_parse(self): parser = UrlParamParser("/fake_route/{resource}/{action}") self.assertEqual({}, parser.resolve_params("/not_the_same_route/moe/smile/"))