Permalink
Please
sign in to comment.
Browse files
Fix missing namespace in table name (#222)
* Tidy modules and ensure latest version * Add test for table names of models with namespaces * Fix table names missing namespace * Move tests to always use a db namespace
- Loading branch information
Showing
with
49 additions
and 346 deletions.
- +2 −7 go.mod
- +4 −323 go.sum
- +3 −2 hack/migrate.sh
- +1 −0 hack/test.env
- +2 −2 models/audit_log_entry.go
- +26 −0 models/db_test.go
- +4 −4 models/instance.go
- +3 −4 models/refresh_token.go
- +3 −3 models/user.go
- +1 −1 models/user_test.go
@@ -0,0 +1,26 @@ | ||
package models_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gobuffalo/pop" | ||
"github.com/netlify/gotrue/models" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTableNameNamespacing(t *testing.T) { | ||
cases := []struct { | ||
expected string | ||
value interface{} | ||
}{ | ||
{expected: "test_audit_log_entries", value: []*models.AuditLogEntry{}}, | ||
{expected: "test_instances", value: []*models.Instance{}}, | ||
{expected: "test_refresh_tokens", value: []*models.RefreshToken{}}, | ||
{expected: "test_users", value: []*models.User{}}, | ||
} | ||
|
||
for _, tc := range cases { | ||
m := &pop.Model{Value: tc.value} | ||
assert.Equal(t, tc.expected, m.TableName()) | ||
} | ||
} |
0 comments on commit
c42b3e9