mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-26 12:30:27 +00:00
fix: inaccruate 401 & sql busy error (#679)
* fix inaccruate 401 error on SQL db error * init golangci-lint config * linter autofix * testify auto fixes * fix sqlite busy errors * fix naming * more linter errors * fix rest of linter issues
This commit is contained in:
parent
b9183109f2
commit
e8449b3a73
62 changed files with 389 additions and 292 deletions
|
@ -5,29 +5,30 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_Group_Create(t *testing.T) {
|
||||
g, err := tRepos.Groups.GroupCreate(context.Background(), "test")
|
||||
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "test", g.Name)
|
||||
|
||||
// Get by ID
|
||||
foundGroup, err := tRepos.Groups.GroupByID(context.Background(), g.ID)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, g.ID, foundGroup.ID)
|
||||
}
|
||||
|
||||
func Test_Group_Update(t *testing.T) {
|
||||
g, err := tRepos.Groups.GroupCreate(context.Background(), "test")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
g, err = tRepos.Groups.GroupUpdate(context.Background(), g.ID, GroupUpdate{
|
||||
Name: "test2",
|
||||
Currency: "eur",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "test2", g.Name)
|
||||
assert.Equal(t, "EUR", g.Currency)
|
||||
}
|
||||
|
@ -38,7 +39,7 @@ func Test_Group_GroupStatistics(t *testing.T) {
|
|||
|
||||
stats, err := tRepos.Groups.StatsGroup(context.Background(), tGroup.ID)
|
||||
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 20, stats.TotalItems)
|
||||
assert.Equal(t, 20, stats.TotalLabels)
|
||||
assert.Equal(t, 1, stats.TotalUsers)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue