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