added new tests for API Endpoints
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,6 @@ func TestGetMasterData(t *testing.T) {
|
||||
character.RegisterRoutes(protected)
|
||||
gsmaster.RegisterRoutes(protected)
|
||||
RegisterRoutes(protected)
|
||||
protected.GET("/maintenance", gsmaster.GetMasterData)
|
||||
protected.GET("/test", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"status": "Test OK"})
|
||||
})
|
||||
|
||||
@@ -397,6 +397,17 @@ func (object *Spell) Save() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (object *Spell) Delete() error {
|
||||
result := database.DB.Delete(&object, object.ID)
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
if result.RowsAffected == 0 {
|
||||
return fmt.Errorf("no record found with ID %v", object.ID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SelectSpells gibt alle Zauber zurück, optional gefiltert nach einem Feld
|
||||
func SelectSpells(opts ...string) ([]Spell, error) {
|
||||
fieldName := ""
|
||||
|
||||
Reference in New Issue
Block a user