cpularp-manager-api/test/api_test.go

121 lines
2.7 KiB
Go
Raw Normal View History

package main
import (
"os"
"testing"
character "example.com/database/character"
customization "example.com/database/customization"
function "example.com/database/function"
functionset "example.com/database/functionset"
functiontag "example.com/database/functiontag"
group "example.com/database/group"
inventoryslot "example.com/database/inventoryslot"
item "example.com/database/item"
itemtag "example.com/database/itemtag"
person "example.com/database/person"
role "example.com/database/role"
schematic "example.com/database/schematic"
tier "example.com/database/tier"
user "example.com/database/user"
functiontagtest "example.com/unit/functiontagtest"
functiontest "example.com/unit/functiontest"
grouptest "example.com/unit/grouptest"
persontest "example.com/unit/persontest"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
)
type testCharacter struct {
Result []character.Character `json:"result"`
}
type testCustomization struct {
Result []customization.Customization `json:"result"`
}
type testFunction struct {
Result []function.Function `json:"result"`
}
type testFunctionSet struct {
Result []functionset.FunctionSet `json:"result"`
}
type testFunctionTag struct {
Result []functiontag.FunctionTag `json:"result"`
}
type testInventorySlot struct {
Result []inventoryslot.InventorySlot `json:"result"`
}
type testItem struct {
Result []item.Item `json:"result"`
}
type testItemTag struct {
Result []itemtag.ItemTag `json:"result"`
}
type testPerson struct {
Result []person.Person `json:"result"`
}
type testRole struct {
Result []role.Role `json:"result"`
}
type testSchematic struct {
Result []schematic.Schematic `json:"result"`
}
type testTier struct {
Result []tier.Tier `json:"result"`
}
type testUser struct {
Result []user.User `json:"result"`
}
type apiTestSuite struct {
suite.Suite
globalAuthHeader string
router *gin.Engine
group group.Group
groupJSON []byte
}
func (s *apiTestSuite) TearDownTestSuite() {
os.Remove("db/main.db")
}
func TestSuite01Group(t *testing.T) {
var groupSuite grouptest.GroupTestSuite
groupSuite.SetupTestSuite()
suite.Run(t, &groupSuite)
groupSuite.TearDownTestSuite()
}
func TestSuite02FunctionTag(t *testing.T) {
var functionTagSuite functiontagtest.FunctionTagTestSuite
functionTagSuite.SetupTestSuite()
suite.Run(t, &functionTagSuite)
functionTagSuite.TearDownTestSuite()
}
func TestSuite03Person(t *testing.T) {
var personSuite persontest.PersonTestSuite
personSuite.SetupTestSuite()
suite.Run(t, &personSuite)
personSuite.TearDownTestSuite()
}
func TestSuite04Function(t *testing.T) {
var functionSuite functiontest.FunctionTestSuite
functionSuite.SetupTestSuite()
suite.Run(t, &functionSuite)
functionSuite.TearDownTestSuite()
}