示例#1
0
func TestDeleteTemplate(t *testing.T) {
	t.Skip("TODO: Start http server")

	var (
		client       = clients.TemplateClient{Host: host}
		name         = "my-template"
		desc         = "my description"
		body         = "<html><head></head><body><h1>Hello world</h1></body>"
		compilerType = "noop"
	)

	tmpl, _ := client.CreateTemplate(name, desc, body, compilerType)
	id := tmpl.Id

	err := client.DeleteTemplate(id)

	if err != nil {
		t.Error(err)
	}

	_, err = client.GetTemplate(id)

	if err == nil {
		t.Error(err)
	}
}
示例#2
0
func TestGetTemplate(t *testing.T) {
	t.Skip("TODO: Start http server")

	var (
		client       = clients.TemplateClient{Host: host}
		name         = "my-template"
		desc         = "my description"
		body         = "<html><head></head><body><h1>Hello world</h1></body>"
		compilerType = "noop"
	)

	tmpl, _ := client.CreateTemplate(name, desc, body, compilerType)
	id := tmpl.Id

	tmpl, err := client.GetTemplate(id)

	if err != nil {
		t.Error(err)
	}

	if tmpl.Name != name || tmpl.Description != desc ||
		tmpl.Body != body || tmpl.CompilerType != compilerType {
		t.Error("Returned template not right")
	}

	_ = client.DeleteTemplate(tmpl.Id)
}