From 31b518ac9b60262fba32b7097faa41220cb09431 Mon Sep 17 00:00:00 2001 From: gouravmpk Date: Mon, 26 Feb 2024 16:47:54 +0530 Subject: [PATCH] removed get person created bounties --- handlers/bounty_test.go | 50 ----------------------------------------- 1 file changed, 50 deletions(-) diff --git a/handlers/bounty_test.go b/handlers/bounty_test.go index 15c683f2b..66908c2e4 100644 --- a/handlers/bounty_test.go +++ b/handlers/bounty_test.go @@ -616,56 +616,6 @@ func TestGetPersonAssignedBounties(t *testing.T) { }) } -func TestGetPersonCreatedBounties(t *testing.T) { - mockDb := dbMocks.NewDatabase(t) - mockHttpClient := mocks.NewHttpClient(t) - bHandler := NewBountyHandler(mockHttpClient, mockDb) - t.Run("Should successfull Get Person Created Bounties", func(t *testing.T) { - rr := httptest.NewRecorder() - handler := http.HandlerFunc(bHandler.GetPersonCreatedBounties) - bounty := db.Bounty{ - ID: 1, - Type: "coding", - Title: "first bounty", - Description: "first bounty description", - OrgUuid: "org-1", - Assignee: "user1", - Created: 1707991475, - OwnerID: "owner-1", - } - - rctx := chi.NewRouteContext() - rctx.URLParams.Add("uuid", "clu80datu2rjujsmim40") - rctx.URLParams.Add("sortBy", "paid") - rctx.URLParams.Add("page", "1") - rctx.URLParams.Add("limit", "20") - rctx.URLParams.Add("search", "") - req, _ := http.NewRequestWithContext(context.WithValue(context.Background(), chi.RouteCtxKey, rctx), http.MethodGet, "people/wanteds/created/clu80datu2rjujsmim40?sortBy=paid&page=1&limit=20&search=", nil) - - mockDb.On("GetCreatedBounties", req).Return([]db.Bounty{bounty}, nil).Once() - mockDb.On("GetPersonByPubkey", "owner-1").Return(db.Person{}, nil).Once() - mockDb.On("GetPersonByPubkey", "user1").Return(db.Person{}, nil).Once() - mockDb.On("GetOrganizationByUuid", "org-1").Return(db.Organization{}, nil).Once() - handler.ServeHTTP(rr, req) - - var returnedBounty []db.BountyResponse - err := json.Unmarshal(rr.Body.Bytes(), &returnedBounty) - assert.NoError(t, err) - assert.Equal(t, http.StatusOK, rr.Code) - assert.NotEmpty(t, returnedBounty) - - var responseData []db.BountyResponse - err = json.Unmarshal(rr.Body.Bytes(), &responseData) - if err != nil { - t.Fatalf("Error decoding JSON response: %s", err) - } - - assert.NotEmpty(t, responseData) - assert.Len(t, responseData, 1) - - }) -} - func TestGetNextBountyByCreated(t *testing.T) { ctx := context.Background()