Пример #1
0
func TestCreateBaseHtmlData(t *testing.T) {
	validContent := "1234 XXX-TOPBAR-XXX XXX-BODY-XXX XXX-INDEX-XXX XXX-BOTTOMBAR-XXX 1234"
	path := test.CreateTestFileReturnPath("foo.html", validContent)
	loadedData := LoadBaseHtmlData(path)

	if validContent != loadedData {
		t.Error("content of baseHtml was not correctly loaded !")
	}
}
Пример #2
0
func TestCreateConfigData(t *testing.T) {
	path := test.CreateTestFileReturnPath("foo.json", test.ConfigDataContent)
	created := CreateConfigData(path)

	if created.Topbar != test.ConfigDataTopBar {
		t.Error("expected value : " + test.ConfigDataTopBar + " but was : " + created.Topbar)
	}
	if created.Bottombar != test.ConfigDataBottomBar {
		t.Error("expected value : " + test.ConfigDataBottomBar + " but was : " + created.Bottombar)
	}
	if created.TitleType != test.ConfigDataTitleAndCatgoryType {
		t.Error("expected value : " + test.ConfigDataTitleAndCatgoryType + " but was : " + created.TitleType)
	}
	if created.IndexName != test.ConfigDataIndexName {
		t.Error("expected value : " + test.ConfigDataIndexName + " but was : " + created.IndexName)
	}
}
Пример #3
0
func TestCreateConfigDataWrongFile(t *testing.T) {
	path := test.CreateTestFileReturnPath("foo.json", test.ConfigDataContent+"asdf asdf")

	testCreateConfigExpectException("error while opening configFile", path+"234", t)
}
Пример #4
0
func TestCreateBaseHtmlDataMissingPlaceHolder4(t *testing.T) {
	path := test.CreateTestFileReturnPath("foo.html", test.ConfigDataContent+"XXX-TOPBAR-XXX XXX-BODY-XXX XXX-INDEX-XXX")

	testLoadBaseHtmlDataExpectException("the baseHtml didn't contain all required placeholders - missing XXX-BOTTOMBAR-XXX", path, t)
}
Пример #5
0
func TestCreateBaseHtmlDataWrongFile(t *testing.T) {
	path := test.CreateTestFileReturnPath("foo.html", "")

	testLoadBaseHtmlDataExpectException("error while opening baseHtmlData", path+"234", t)
}
Пример #6
0
func TestCheckFilePathForOutputFolderExists(t *testing.T) {
	filename := test.CreateTestFileReturnPath("validEnding.yaml", "")
	filename2 := test.CreateTestFileReturnPath("validEnding.html", "")
	workingDir := test.GetTestPath()
	testAndExpectPanic(filename, filename2, workingDir, filename+"sdf", "argument error - directory does not exist", t)
}
Пример #7
0
func TestLoadContentDataWrongPath(t *testing.T) {
	path := test.CreateTestFileReturnPath("foo.html", test.ContentData)

	testLoadContentDataExpectException("error path has to point to a directory", path, t)
}
Пример #8
0
func TestCheckFilePathForContentFolderIsADirectory(t *testing.T) {
	filename := test.CreateTestFileReturnPath("validEnding.yaml", "")
	filename2 := test.CreateTestFileReturnPath("validEnding.html", "")
	testAndExpectPanic(filename, filename2, filename2, "asdf", "argument error - is not a directory", t)
}
Пример #9
0
func TestCheckDirectoryExistsForContentFolder(t *testing.T) {
	filename := test.CreateTestFileReturnPath("validEnding.yaml", "")
	filename2 := test.CreateTestFileReturnPath("validEnding.html", "")
	testAndExpectPanic(filename, filename2, "asdf", "asdf", "argument error - directory does not exist", t)
}
Пример #10
0
func TestCheckFileHasCorrectEndingForBaseHtml(t *testing.T) {
	filename := test.CreateTestFileReturnPath("validEnding.yaml", "")
	filename2 := test.CreateTestFileReturnPath("fileWithWrongEnding.txt", "")
	testAndExpectPanic(filename, filename2, "asdf", "asdf", "argument error - file has incorrect file ending", t)
}
Пример #11
0
func TestCheckFileExistsForBaseHtml(t *testing.T) {
	filename := test.CreateTestFileReturnPath("validEnding.yaml", "")
	testAndExpectPanic(filename, "asdf", "asdf", "asdf", "argument error - file does not exist", t)
}
Пример #12
0
func TestCheckFileHasCorrectEndingForConfigFile(t *testing.T) {
	filename := test.CreateTestFileReturnPath("fileWithWrongEnding.txt", "")
	testAndExpectPanic(filename, "asdf", "asdf", "asdf", "argument error - file has incorrect file ending", t)
}