示例#1
0
def test_find_file_field(basic_site_config, content_type, field_name):
    """The expected file field should be returned if any"""
    site_config = SiteConfig(basic_site_config)
    config_item = next(
        (item
         for item in site_config.iter_items() if item.name == content_type),
        None)
    file_field = site_config.find_file_field(config_item)
    if field_name:
        assert file_field["name"] == "image"
    else:
        assert file_field is None
示例#2
0
 def get_config_file_field(self) -> Dict:
     """Get the site config file field for the object, if any"""
     site_config = SiteConfig(self.website.starter.config)
     content_config = site_config.find_item_by_name(self.type)
     if content_config:
         return site_config.find_file_field(content_config)