예제 #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'
예제 #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'
예제 #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()
예제 #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'
예제 #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
예제 #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'
예제 #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'
예제 #8
0
def test_init_defaults():
    new_site = site.Site()
    assert new_site.config_file == 'config.yaml', 'Default option not set'
예제 #9
0
def test_sanity():
    new_site = site.Site()
    assert new_site.base_test()