def test_provided_empty(self): option = config_options.Pages() value = option.validate([]) self.assertEqual(None, value) option.post_validation({'extra_stuff': []}, 'extra_stuff')
def test_provided_dict(self): option = config_options.Pages() value = option.validate(['index.md', {"Page": "page.md"}]) self.assertEqual(['index.md', {'Page': 'page.md'}], value) option.post_validation({'extra_stuff': []}, 'extra_stuff')
def test_provided(self): option = config_options.Pages() value = option.validate([['index.md', ], ]) self.assertEqual(['index.md', ], value) option.post_validation({'extra_stuff': []}, 'extra_stuff')
def test_old_format(self): option = config_options.Pages() self.assertRaises( config_options.ValidationError, option.validate, [['index.md', ], ] )
def test_provided_dict(self): option = config_options.Pages() value = option.validate( ['index.md', legacy.OrderedDict((( 'Page', 'page.md', ), ))]) self.assertEqual(['index.md', {'Page': 'page.md'}], value) option.post_validation({'extra_stuff': []}, 'extra_stuff')
# Once we drop Python 2.6 support, this could be an OrderedDict, however, it # isn't really needed either as we always sequentially process the schema other # than at initialisation when we grab the full set of keys for convenience. DEFAULT_SCHEMA = ( # Reserved for internal use, stores the mkdocs.yml config file. ('config_file_path', config_options.Type(utils.string_types)), # The title to use for the documentation ('site_name', config_options.Type(utils.string_types, required=True)), # Defines the structure of the navigation and which markdown files are # included in the build. ('pages', config_options.Pages()), # The full URL to where the documentation will be hosted ('site_url', config_options.URL()), # A description for the documentation project that will be added to the # HTML meta tags. ('site_description', config_options.Type(utils.string_types)), # The name of the author to add to the HTML meta tags ('site_author', config_options.Type(utils.string_types)), # The MkDocs theme for the documentation. ('theme', config_options.Theme(default='mkdocs')), # The directory containing the documentation markdown. ('docs_dir', config_options.Dir(default='docs', exists=True)),
def test_invalid_config(self): option = config_options.Pages() self.assertRaises(config_options.ValidationError, option.validate, [[], 1])