Exemple #1
0
    def test_do_not_use_folder_as_category(self):

        settings = DEFAULT_CONFIG.copy()
        settings['ARTICLE_DIR'] = 'content'
        settings['DEFAULT_CATEGORY'] = 'Default'
        settings['DEFAULT_DATE'] = (1970, 1, 1)
        settings['USE_FOLDER_AS_CATEGORY'] = False
        settings['filenames'] = {}
        generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR,
                                      DEFAULT_CONFIG['THEME'], None,
                                      DEFAULT_CONFIG['MARKUP'])
        generator.generate_context()
        # test for name
        # categories are grouped by slug; if two categories have the same slug
        # but different names they will be grouped together, the first one in
        # terms of process order will define the name for that category
        categories = [cat.name for cat, _ in generator.categories]
        categories_alternatives = (
            sorted(['Default', 'Yeah', 'test', '指導書']),
            sorted(['Default', 'yeah', 'test', '指導書']),
        )
        self.assertTrue(sorted(categories) in categories_alternatives)
        # test for slug
        categories = [cat.slug for cat, _ in generator.categories]
        categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
        self.assertEqual(sorted(categories), sorted(categories_expected))
Exemple #2
0
    def test_do_not_use_folder_as_category(self):

        settings = DEFAULT_CONFIG.copy()
        settings['ARTICLE_DIR'] = 'content'
        settings['DEFAULT_CATEGORY'] = 'Default'
        settings['DEFAULT_DATE'] = (1970, 1, 1)
        settings['USE_FOLDER_AS_CATEGORY'] = False
        settings['filenames'] = {}
        generator = ArticlesGenerator(
            settings.copy(), settings, CUR_DIR, DEFAULT_CONFIG['THEME'], None,
            DEFAULT_CONFIG['MARKUP'])
        generator.generate_context()
        # test for name
        # categories are grouped by slug; if two categories have the same slug
        # but different names they will be grouped together, the first one in
        # terms of process order will define the name for that category
        categories = [cat.name for cat, _ in generator.categories]
        categories_alternatives = (
            sorted(['Default', 'Yeah', 'test', '指導書']),
            sorted(['Default', 'yeah', 'test', '指導書']),
        )
        self.assertTrue(sorted(categories) in categories_alternatives)
        # test for slug
        categories = [cat.slug for cat, _ in generator.categories]
        categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
        self.assertEqual(sorted(categories), sorted(categories_expected))
def create_generator(path):
    settings = DEFAULT_CONFIG.copy()
    settings['filenames'] = {}
    settings['CACHE_CONTENT'] = False  # cache not needed for this logic tests
    return ArticlesGenerator(context=settings.copy(),
                             settings=settings,
                             path=path,
                             theme=settings['THEME'],
                             output_path=None)
Exemple #4
0
def get_settings(**kwargs):
    """Provide tweaked setting dictionaries for testing

    Set keyword arguments to override specific settings.
    """
    settings = DEFAULT_CONFIG.copy()
    for key,value in kwargs.items():
        settings[key] = value
    return settings
Exemple #5
0
def get_settings(**kwargs):
    """Provide tweaked setting dictionaries for testing

    Set keyword arguments to override specific settings.
    """
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    return settings
Exemple #6
0
import glob
from pathlib import Path

from pelican.settings import DEFAULT_CONFIG
from pelican.readers import MarkdownReader

config = DEFAULT_CONFIG.copy()

AUTHOR = 'Noah Hoffman'
SITENAME = 'Noah Hoffman, MD, PhD'
SITEURL = 'https://faculty.washington.edu/ngh2/home'
SITELOGO = SITEURL + '/images/noah-hoffman.jpg'

PATH = 'content'

TIMEZONE = 'America/Los_Angeles'

DEFAULT_LANG = 'en'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (
    ('DLMP Bio', 'https://dlmp.uw.edu/faculty/hoffman'),
    ('UW Medicine Bio', 'http://www.uwmedicine.org/bios/noah-hoffman'),
    ('borborygmi (blog)', 'https://nhoffman.github.io/borborygmi/'),
def get_settings(**kwargs):
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    settings['PLUGINS'] = ['microdata']
    return settings
def get_settings(**kwargs):
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    return settings
 def setUp(self):
     settings = DEFAULT_CONFIG.copy()
     settings['EXTRA_TEMPLATES_PATHS'] = ['.']
     context = settings.copy()
     self.generator = Generator(context, settings, settings['PATH'],
                                settings['THEME'], settings['OUTPUT_PATH'])
def get_settings(**kwargs):
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    return settings
Exemple #11
0
def create_generator(path):
    settings = DEFAULT_CONFIG.copy()
    settings['filenames'] = {}
    settings['CACHE_CONTENT'] = False  # cache not needed for this logic tests
    return ArticlesGenerator(context=settings.copy(), settings=settings,
                             path=path, theme=settings['THEME'], output_path=None)