Chore: Add context to org (#40685)

* Add context to org

* Rebase

* Fix rebase
This commit is contained in:
idafurjes
2021-11-03 11:31:56 +01:00
committed by GitHub
parent 91da1bbb79
commit 47f6bb3583
24 changed files with 120 additions and 112 deletions
+7 -7
View File
@@ -25,14 +25,14 @@ func TestAccountDataAccess(t *testing.T) {
for i := 1; i < 4; i++ {
cmd = &models.CreateOrgCommand{Name: fmt.Sprint("Org #", i)}
err = CreateOrg(cmd)
err = CreateOrg(context.Background(), cmd)
require.NoError(t, err)
ids = append(ids, cmd.Result.Id)
}
query := &models.SearchOrgsQuery{Ids: ids}
err = SearchOrgs(query)
err = SearchOrgs(context.Background(), query)
require.NoError(t, err)
require.Equal(t, len(query.Result), 3)
@@ -42,13 +42,13 @@ func TestAccountDataAccess(t *testing.T) {
sqlStore = InitTestDB(t)
for i := 1; i < 4; i++ {
cmd := &models.CreateOrgCommand{Name: fmt.Sprint("Org #", i)}
err := CreateOrg(cmd)
err := CreateOrg(context.Background(), cmd)
require.NoError(t, err)
}
t.Run("Should be able to search with defaults", func(t *testing.T) {
query := &models.SearchOrgsQuery{}
err := SearchOrgs(query)
err := SearchOrgs(context.Background(), query)
require.NoError(t, err)
require.Equal(t, len(query.Result), 3)
@@ -56,7 +56,7 @@ func TestAccountDataAccess(t *testing.T) {
t.Run("Should be able to limit search", func(t *testing.T) {
query := &models.SearchOrgsQuery{Limit: 1}
err := SearchOrgs(query)
err := SearchOrgs(context.Background(), query)
require.NoError(t, err)
require.Equal(t, len(query.Result), 1)
@@ -64,7 +64,7 @@ func TestAccountDataAccess(t *testing.T) {
t.Run("Should be able to limit and paginate search", func(t *testing.T) {
query := &models.SearchOrgsQuery{Limit: 2, Page: 1}
err := SearchOrgs(query)
err := SearchOrgs(context.Background(), query)
require.NoError(t, err)
require.Equal(t, len(query.Result), 1)
@@ -278,7 +278,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(&models.DeleteOrgCommand{Id: ac2.OrgId})
err := DeleteOrg(context.Background(), &models.DeleteOrgCommand{Id: ac2.OrgId})
require.NoError(t, err)
// remove ac2 user from ac1 org