def test_match_atomic_resource_name(self):
     template = PathTemplate('buckets/*/*/objects/*')
     self.assertEqual({'$0': 'f', '$1': 'o', '$2': 'bar'},
                      template.match('buckets/f/o/objects/bar'))
     template = PathTemplate('/buckets/{hello}')
     self.assertEqual({'hello': 'world'},
                      template.match('buckets/world'))
     template = PathTemplate('/buckets/{hello=*}')
     self.assertEqual({'hello': 'world'},
                      template.match('buckets/world'))
예제 #2
0
 def test_match_atomic_resource_name(self):
     template = PathTemplate('buckets/*/*/objects/*')
     self.assertEqual({'$0': 'f', '$1': 'o', '$2': 'bar'},
                      template.match('buckets/f/o/objects/bar'))
     template = PathTemplate('/buckets/{hello}')
     self.assertEqual({'hello': 'world'},
                      template.match('buckets/world'))
     template = PathTemplate('/buckets/{hello=*}')
     self.assertEqual({'hello': 'world'},
                      template.match('buckets/world'))
 def test_match_with_unbound_in_middle(self):
     template = PathTemplate('bar/**/foo/*')
     self.assertEqual({'$0': 'foo/foo', '$1': 'bar'},
                      template.match('bar/foo/foo/foo/bar'))
 def test_match_template_with_unbounded_wildcard(self):
     template = PathTemplate('buckets/*/objects/**')
     self.assertEqual({'$0': 'foo', '$1': 'bar/baz'},
                      template.match('buckets/foo/objects/bar/baz'))
 def test_match_escaped_chars(self):
     template = PathTemplate('buckets/*/objects')
     self.assertEqual({'$0': 'hello%2F%2Bworld'},
                      template.match('buckets/hello%2F%2Bworld/objects'))
예제 #6
0
 def test_match_with_unbound_in_middle(self):
     template = PathTemplate('bar/**/foo/*')
     self.assertEqual({'$0': 'foo/foo', '$1': 'bar'},
                      template.match('bar/foo/foo/foo/bar'))
예제 #7
0
 def test_match_template_with_unbounded_wildcard(self):
     template = PathTemplate('buckets/*/objects/**')
     self.assertEqual({'$0': 'foo', '$1': 'bar/baz'},
                      template.match('buckets/foo/objects/bar/baz'))
예제 #8
0
 def test_match_escaped_chars(self):
     template = PathTemplate('buckets/*/objects')
     self.assertEqual({'$0': 'hello%2F%2Bworld'},
                      template.match('buckets/hello%2F%2Bworld/objects'))