Ejemplo n.º 1
0
def test_sort_posts():
    new_site = site.Site()
    new_site.posts = test_posts
    new_site.sort_posts()
    print[post for post in new_site.posts]
    # this is ganky :(
    assert new_site.posts[0][
        'date'] == '2013-10-22', 'sort did not reverse posts'
    assert new_site.posts[-1][
        'filename'] == 'no-date.md', 'sort did not correctly handle a post without a date'
Ejemplo n.º 2
0
def test_ready_build_directory():
    test_file = os.path.join(test_output_dir, 'foo.txt')
    test_dir = os.path.join(test_output_dir, 'blazdir')

    with open(test_file, 'w') as outfile:
        outfile.write('I am foo')

    if not os.path.exists(test_dir):
        os.makedirs(test_dir)

    new_site = site.Site(input_dir=test_source_dir, output_dir=test_output_dir)
    new_site.ready_build_directory()

    assert not os.path.isfile(
        test_file), 'ready_build_directory did not remove old files'
    assert not os.path.exists(
        test_dir), 'ready_build did not remove directories'
Ejemplo n.º 3
0
def test_create():
    new_site = site.Site(input_dir=test_source_dir, output_dir=test_output_dir)
    new_site.gather_content()
    new_site.ready_build_directory()
    new_site.create()
Ejemplo n.º 4
0
def test_gather_content():
    new_site = site.Site(input_dir=test_source_dir, output_dir=test_output_dir)
    new_site.gather_content()

    assert len(new_site.posts) > 1, 'did not gather content'
Ejemplo n.º 5
0
def test_default_source_path():
    new_site = site.Site()
    assert new_site.posts_source_path == 'source/content/posts', 'Incorrect default source path: %s ' % new_site.posts_source_path
Ejemplo n.º 6
0
def test_set_and_default():
    new_site = site.Site(input_dir=test_source_dir)
    assert new_site.input_dir == test_source_dir and new_site.config_file == 'config.yaml', 'Default and Custom option not properly set'
Ejemplo n.º 7
0
def test_set_options():
    new_site = site.Site(input_dir=test_source_dir)
    assert new_site.input_dir == test_source_dir, 'Provided Custom option not set'
Ejemplo n.º 8
0
def test_init_defaults():
    new_site = site.Site()
    assert new_site.config_file == 'config.yaml', 'Default option not set'
Ejemplo n.º 9
0
def test_sanity():
    new_site = site.Site()
    assert new_site.base_test()