Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in misc files (#43926)
* Refactor: Change sqlstore.inTransaction to SQLStore.WithTransactionalDBSession in misc files * Refactor: Change .inTransaction in org.go file * Refactor: Update init() to proper SQLStore handlers * Refactor: Update funcs in tests to be sqlStore methods * Refactor: Update API funcs to receive HTTPServer * Fix: define methods on sqlstore * Adjust GetSignedInUser calls * Refactor: Add sqlStore to Service struct * Chore: Add back black spaces to remove file from PR Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
This commit is contained in:
co-authored by
Ida Furjesova
parent
eed9e5543d
commit
92ca38bedf
@@ -195,7 +195,7 @@ func TestAccountDataAccess(t *testing.T) {
|
||||
|
||||
t.Run("Can get logged in user projection", func(t *testing.T) {
|
||||
query := models.GetSignedInUserQuery{UserId: ac2.Id}
|
||||
err := GetSignedInUser(context.Background(), &query)
|
||||
err := sqlStore.GetSignedInUser(context.Background(), &query)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, query.Result.Email, "ac2@test.com")
|
||||
@@ -256,7 +256,7 @@ func TestAccountDataAccess(t *testing.T) {
|
||||
|
||||
t.Run("SignedInUserQuery with a different org", func(t *testing.T) {
|
||||
query := models.GetSignedInUserQuery{UserId: ac2.Id}
|
||||
err := GetSignedInUser(context.Background(), &query)
|
||||
err := sqlStore.GetSignedInUser(context.Background(), &query)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, query.Result.OrgId, ac1.OrgId)
|
||||
@@ -273,7 +273,7 @@ func TestAccountDataAccess(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
query := models.GetSignedInUserQuery{UserId: ac2.Id}
|
||||
err = GetSignedInUser(context.Background(), &query)
|
||||
err = sqlStore.GetSignedInUser(context.Background(), &query)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, query.Result.OrgId, ac2.OrgId)
|
||||
@@ -282,7 +282,7 @@ func TestAccountDataAccess(t *testing.T) {
|
||||
|
||||
t.Run("Removing user from org should delete user completely if in no other org", func(t *testing.T) {
|
||||
// make sure ac2 has no org
|
||||
err := DeleteOrg(context.Background(), &models.DeleteOrgCommand{Id: ac2.OrgId})
|
||||
err := sqlStore.DeleteOrg(context.Background(), &models.DeleteOrgCommand{Id: ac2.OrgId})
|
||||
require.NoError(t, err)
|
||||
|
||||
// remove ac2 user from ac1 org
|
||||
@@ -291,7 +291,7 @@ func TestAccountDataAccess(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.True(t, remCmd.UserWasDeleted)
|
||||
|
||||
err = GetSignedInUser(context.Background(), &models.GetSignedInUserQuery{UserId: ac2.Id})
|
||||
err = sqlStore.GetSignedInUser(context.Background(), &models.GetSignedInUserQuery{UserId: ac2.Id})
|
||||
require.Equal(t, err, models.ErrUserNotFound)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user