예제 #1
0
 def match_default_fixture(self, request):
     partname_str, ext, content_type = request.param
     partname = PackURI(partname_str)
     ct_map = _ContentTypeMap()
     ct_map._add_override(PackURI('/bar/foo.xyz'), 'application/xyz')
     ct_map._add_default(ext, content_type)
     return ct_map, partname, content_type
예제 #2
0
 def match_default_fixture(self, request):
     partname_str, ext, content_type = request.param
     partname = PackURI(partname_str)
     ct_map = _ContentTypeMap()
     ct_map._add_override(PackURI('/bar/foo.xyz'), 'application/xyz')
     ct_map._add_default(ext, content_type)
     return ct_map, partname, content_type
예제 #3
0
 def match_override_fixture(self, request):
     partname_str, should_match_partname_str = request.param
     partname = PackURI(partname_str)
     should_match_partname = PackURI(should_match_partname_str)
     content_type = 'appl/vnd-foobar'
     ct_map = _ContentTypeMap()
     ct_map._add_override(partname, content_type)
     return ct_map, should_match_partname, content_type
예제 #4
0
 def match_override_fixture(self, request):
     partname_str, should_match_partname_str = request.param
     partname = PackURI(partname_str)
     should_match_partname = PackURI(should_match_partname_str)
     content_type = 'appl/vnd-foobar'
     ct_map = _ContentTypeMap()
     ct_map._add_override(partname, content_type)
     return ct_map, should_match_partname, content_type
예제 #5
0
 def it_should_raise_on_key_not_instance_of_PackURI(self):
     ct_map = _ContentTypeMap()
     ct_map._overrides = {PackURI('/part/name1.xml'): 'app/vnd.type1'}
     with pytest.raises(KeyError):
         ct_map['/part/name1.xml']
예제 #6
0
 def it_should_raise_on_partname_not_found(self):
     ct_map = _ContentTypeMap()
     with pytest.raises(KeyError):
         ct_map[PackURI('/!blat/rhumba.1x&')]
예제 #7
0
 def it_should_raise_on_key_not_instance_of_PackURI(self):
     ct_map = _ContentTypeMap()
     ct_map._overrides = {PackURI('/part/name1.xml'): 'app/vnd.type1'}
     with pytest.raises(KeyError):
         ct_map['/part/name1.xml']
예제 #8
0
 def it_should_raise_on_partname_not_found(self):
     ct_map = _ContentTypeMap()
     with pytest.raises(KeyError):
         ct_map[PackURI('/!blat/rhumba.1x&')]