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
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
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
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
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']
def it_should_raise_on_partname_not_found(self): ct_map = _ContentTypeMap() with pytest.raises(KeyError): ct_map[PackURI('/!blat/rhumba.1x&')]
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']
def it_should_raise_on_partname_not_found(self): ct_map = _ContentTypeMap() with pytest.raises(KeyError): ct_map[PackURI('/!blat/rhumba.1x&')]