Exemple #1
0
func TestDeleteItem(t *testing.T) {
	testhelper.PrepareConfig()

	item := NewItem(3, 3, "spent", "first spent", 1.2)
	item.Save()

	item.Delete()
}
Exemple #2
0
func TestSaveItem(t *testing.T) {
	testhelper.PrepareConfig()

	item := NewItem(3, 3, "spent", "first spent", 1.2)
	item.Save()
	if item.Id == 0 {
		t.Fail()
	}
}
Exemple #3
0
func TestSaveCategory(t *testing.T) {
	testhelper.PrepareConfig()

	category := NewCategory(1, "spent", "test", "test")
	category.Save()
	if category.Id == 0 {
		t.Fail()
	}
}
Exemple #4
0
func TestSaveUser(t *testing.T) {
	testhelper.PrepareConfig()

	user := NewUser("user", "email", "spent")
	user.Save()
	if user.Id == 0 {
		t.Fail()
	}
}
func TestNewAddCategoryCommand(t *testing.T) {
	testhelper.PrepareConfig()
	categoryTitle := "Category Title"
	categoryType := "spent"

	addCategoryCommand = NewAddCategoryCommand(Attributes{
		Title:    &categoryTitle,
		Slug:     &categoryTitle,
		ItemType: &categoryType,
	})

}
Exemple #6
0
func TestFindItem(t *testing.T) {
	testhelper.PrepareConfig()

	item := NewItem(3, 3, "spent", "first spent", 1.2)
	item.Save()

	newitem := &Item{}
	newitem.Find(item.Id)
	// log.Fatal(item)
	if newitem.Amount != 1.2 {
		t.Fail()
	}
}
Exemple #7
0
func TestFindCategory(t *testing.T) {
	testhelper.PrepareConfig()

	category := NewCategory(1, "spent", "test", "test")
	category.Save()

	newcategory := &Category{}
	newcategory.Find(category.Id)
	// log.Fatal(item)
	if newcategory.Title != "test" {
		t.Fail()
	}
}
Exemple #8
0
func TestFindUser(t *testing.T) {
	testhelper.PrepareConfig()

	user := NewUser("user", "email", "spent")
	user.Save()

	newuser := &User{}
	newuser.Find(user.Id)
	// log.Fatal(item)
	if newuser.Email != "email" {
		t.Fail()
	}
}
func TestNewAddItemCommand(t *testing.T) {
	testhelper.PrepareConfig()
	amount := 20.00
	categoryTitle := "Category Title"
	itemType := "Item Type"
	comment := "Comment"

	addItemCommand = NewAddItemCommand(Attributes{
		Amount:        &amount,
		CategoryTitle: &categoryTitle,
		ItemType:      &itemType,
		Comment:       &comment,
	})

}
Exemple #10
0
func TestGetCategoryTitle(t *testing.T) {
	testhelper.PrepareConfig()

	category := NewCategory(1, "spent", "test", "test")
	category.Save()

	item := NewItem(3, category.Id, "spent", "first spent", 1.2)
	item.Save()

	newitem := &Item{}
	newitem.Find(item.Id)
	if newitem.GetCategoryTitle() != "test" {
		t.Fail()
	}
}
func TestAddItemCommandValidate(t *testing.T) {
	testhelper.PrepareConfig()
	addItemCommand.Validate()
}
Exemple #12
0
func TestNewCategory(t *testing.T) {
	testhelper.PrepareConfig()
	_ = NewCategory(1, "spent", "test", "test")
}
func TestAddCategoryCommandRun(t *testing.T) {
	testhelper.PrepareConfig()
	addCategoryCommand.Run()
}
func TestAddItemCommandRun(t *testing.T) {
	testhelper.PrepareConfig()
	addItemCommand.Run()
}
Exemple #15
0
func TestNewItem(t *testing.T) {
	testhelper.PrepareConfig()
	_ = NewItem(3, 3, "", "first spent", 1.2)
}
func TestAddItemCommandUsage(t *testing.T) {
	testhelper.PrepareConfig()
	addItemCommand.Usage(nil)
}
Exemple #17
0
func TestNewUser(t *testing.T) {
	testhelper.PrepareConfig()
	_ = NewUser("user", "email", "spent")
}