func TestQuery(t *testing.T) {
	results, err := FindAll(Published())
	if err != nil {
		t.Errorf("tags: error getting tags :%s", err)
	}
	if len(results) == 0 {
		t.Errorf("tags: published tags not found :%s", err)
	}
	results, err = FindAll(Query().Where("id>=? AND id <=?", 0, 100))
	if err != nil || len(results) == 0 {
		t.Errorf("tags: no tag found :%s", err)
	}
	if len(results) > 1 {
		t.Errorf("tags: more than one tag found for where :%s", err)
	}
}
TestQuery tests trying to find published resources
package tags
import (
	"testing"
	"github.com/fragmenta/fragmenta-cms/src/lib/resource"
)
var testName = "foo"
func TestSetup(t *testing.T) {
	err := resource.SetupTestDatabase(2)
	if err != nil {
		t.Errorf("tags: Setup db failed %s", err)
	}
}
func TestCreateTag(t *testing.T) {
	tagParams := map[string]string{
		"name":   testName,
		"status": "100",
	}
	id, err := New().Create(tagParams)
	if err != nil {
		t.Errorf("tags: Create tag failed :%s", err)
	}
	tag, err := Find(id)
	if err != nil {
		t.Errorf("tags: Create tag find failed")
	}
	if tag.Name != testName {
		t.Errorf("tags: Create tag name failed expected:%s got:%s", testName, tag.Name)
	}
}
func TestListTag(t *testing.T) {
	results, err := FindAll(Query())
	if err != nil {
		t.Errorf("tags: List no tag found :%s", err)
	}
	if len(results) < 1 {
		t.Errorf("tags: List no tags found :%s", err)
	}
}
func TestUpdateTag(t *testing.T) {
	tag, err := FindFirst("name=?", testName)
	if err != nil {
		t.Errorf("tags: Update no tag found :%s", err)
	}
	name := "bar"
	tagParams := map[string]string{"name": name}
	err = tag.Update(tagParams)
	if err != nil {
		t.Errorf("tags: Update tag failed :%s", err)
	}
	tag, err = Find(tag.ID)
	if err != nil {
		t.Errorf("tags: Update tag fetch failed :%s", tag.Name)
	}
	if tag.Name != name {
		t.Errorf("tags: Update tag failed :%s", tag.Name)
	}
}