Пример #1
0
def test_server_options():
	options, r = server_options_parser.parse_args(args=["--nofork"])
	config = SiteConfig(options)
	assert config["port"] == 4444
	assert config["debug"] == False
	assert config["css-compress"] == True

	options, r = server_options_parser.parse_args(args=["--port=555"])
	config = SiteConfig(options)
	assert config["port"] == 555

	options, r = server_options_parser.parse_args(args=["--debug"])
	config = SiteConfig(options)
	assert config["debug"] == True
	assert config["css-compress"] == False
Пример #2
0
def test_split_matter_content():
	apply_site_dirs("",force_project_path=join(pages_test_root,"web"))
	options, r = server_options_parser.parse_args(args=["--nofork"])
	config = SiteConfig(options)

	header = {
		"Content-Type": "text/html",
	}
	content = None
	with open(abspath(join(site.PROJECT_DIR,"unicode.md")), "rb") as f:
		content = f.read()

	#expander = FileExpander(site.PROJECT_DIR,"unicode.md",config=config)
	#self.header,self.content,self.fetchContent = self._get_matter_and_content(relpath,header)
	header2,content2 = config.split_matter_and_utf8_content(content,header)	
	assert type(content2) == unicode
	assert "test" in header2
	assert type(header2["test"]) == unicode
Пример #3
0
def test_double_dashes():
	apply_site_dirs("",force_project_path=join(pages_test_root,"web"))
	options, r = server_options_parser.parse_args(args=["--nofork"])
	config = SiteConfig(options)

	header = {
		"Content-Type": "text/html",
	}
	content = """---
test: test
---
abc---def
123---456
"""
	expected = """
abc---def
123---456
"""
	header2,content2 = config.split_matter_and_utf8_content(content,header)	
	#print >>sys.stderr, "from:", content2, "to:", expected, "end"
	assert content2 == expected