Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [#441] Optimize the HTTP testing process [#1] #704

Merged
merged 26 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3484964
implement http testing
kkumar-gcc Oct 30, 2024
83b448e
optimize code
kkumar-gcc Oct 30, 2024
a39791c
chore: update mocks
kkumar-gcc Oct 30, 2024
1e3aefc
fix code review
kkumar-gcc Oct 30, 2024
2527a3c
Merge remote-tracking branch 'origin/kkumar-gcc/#441' into kkumar-gcc…
kkumar-gcc Oct 30, 2024
6875317
chore: update mocks
kkumar-gcc Oct 30, 2024
918b33f
Merge branch 'master' into kkumar-gcc/#441
kkumar-gcc Oct 30, 2024
3860e12
optimize cookies expiration logic
kkumar-gcc Oct 30, 2024
8be2f31
add test cases for test_response
kkumar-gcc Oct 30, 2024
0f3e222
fix:lint
kkumar-gcc Oct 30, 2024
a8fb26d
use response recorder
kkumar-gcc Oct 30, 2024
8ddbad4
update go mod
kkumar-gcc Oct 30, 2024
c0d8e37
change cookie value type to string
kkumar-gcc Oct 31, 2024
83e180c
chore: update mocks
kkumar-gcc Oct 31, 2024
9b2b148
remove mutex
kkumar-gcc Oct 31, 2024
fc4a998
Merge remote-tracking branch 'origin/kkumar-gcc/#441' into kkumar-gcc…
kkumar-gcc Oct 31, 2024
328cb7a
update test response
kkumar-gcc Oct 31, 2024
cdefff2
add more test cases for test response
kkumar-gcc Oct 31, 2024
0a92665
Merge branch 'master' into kkumar-gcc/#441
kkumar-gcc Oct 31, 2024
f87b5fb
driver specific http testing process
kkumar-gcc Oct 31, 2024
dec1cf6
directly use r.t
kkumar-gcc Oct 31, 2024
6ccc7f7
use Test method for testing
kkumar-gcc Oct 31, 2024
183925e
update cookie assertion logic
kkumar-gcc Oct 31, 2024
dd9a32e
.
kkumar-gcc Oct 31, 2024
d790d4a
add isCookieExpired Method
kkumar-gcc Oct 31, 2024
17b7e1d
optimize cookie expiration logic
kkumar-gcc Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions contracts/testing/test_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package testing

type TestRequest interface {
WithHeaders(headers map[string]string) TestRequest
WithHeader(key, value string) TestRequest
WithoutHeader(key string) TestRequest
WithCookies(cookies map[string]string) TestRequest
kkumar-gcc marked this conversation as resolved.
Show resolved Hide resolved
WithCookie(key, value string) TestRequest
Get(uri string) (TestResponse, error)
}
35 changes: 35 additions & 0 deletions contracts/testing/test_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package testing

type TestResponse interface {
AssertStatus(status int) TestResponse
AssertOk() TestResponse
AssertCreated() TestResponse
AssertAccepted() TestResponse
AssertNoContent(status ...int) TestResponse
AssertMovedPermanently() TestResponse
AssertFound() TestResponse
AssertNotModified() TestResponse
AssertPartialContent() TestResponse
AssertTemporaryRedirect() TestResponse
AssertBadRequest() TestResponse
AssertUnauthorized() TestResponse
AssertPaymentRequired() TestResponse
AssertForbidden() TestResponse
AssertNotFound() TestResponse
AssertMethodNotAllowed() TestResponse
AssertNotAcceptable() TestResponse
AssertConflict() TestResponse
AssertRequestTimeout() TestResponse
AssertGone() TestResponse
AssertUnsupportedMediaType() TestResponse
AssertUnprocessableEntity() TestResponse
AssertTooManyRequests() TestResponse
AssertInternalServerError() TestResponse
AssertServiceUnavailable() TestResponse
AssertHeader(headerName, value string) TestResponse
AssertHeaderMissing(headerName string) TestResponse
AssertCookie(name, value string) TestResponse
AssertCookieExpired(name string) TestResponse
AssertCookieNotExpired(name string) TestResponse
AssertCookieMissing(name string) TestResponse
kkumar-gcc marked this conversation as resolved.
Show resolved Hide resolved
}
kkumar-gcc marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion database/factory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/brianvoe/gofakeit/v6"
"github.com/brianvoe/gofakeit/v7"
"github.com/stretchr/testify/suite"
gormio "gorm.io/gorm"

Expand Down
1 change: 1 addition & 0 deletions errors/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var (
ScheduleFacadeNotSet = New("schedule facade is not initialized")
StorageFacadeNotSet = New("storage facade is not initialized")
InvalidHttpContext = New("invalid http context")
RouteFacadeNotSet = New("route facade is not initialized")

AuthEmptySecret = New("authentication secret is missing or required")
AuthInvalidClaims = New("authentication token contains invalid claims")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ go 1.22.0
require (
github.com/RichardKnop/machinery/v2 v2.0.13
github.com/brianvoe/gofakeit/v7 v7.1.1
github.com/brianvoe/gofakeit/v7 v7.1.1
github.com/charmbracelet/huh v0.6.0
github.com/charmbracelet/huh/spinner v0.0.0-20241028115900-20a4d21717a8
github.com/charmbracelet/lipgloss v0.13.1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/gabriel-vasile/mimetype v1.4.6
github.com/glebarez/go-sqlite v1.22.0
github.com/glebarez/sqlite v1.11.0
github.com/go-sql-driver/mysql v1.8.1
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/golang-migrate/migrate/v4 v4.18.1
github.com/golang-module/carbon/v2 v2.4.1
Expand Down Expand Up @@ -167,3 +165,5 @@ require (
modernc.org/memory v1.7.2 // indirect
modernc.org/sqlite v1.28.0 // indirect
)

require github.com/go-sql-driver/mysql v1.8.1 // indirect
kkumar-gcc marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ github.com/aws/aws-sdk-go v1.49.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3Tju
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4=
github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
github.com/brianvoe/gofakeit/v7 v7.1.1 h1:/DEG+f/mFtqqNjhZ0AXA0aDzrnfE85AcAKVE+mMdxAQ=
github.com/brianvoe/gofakeit/v7 v7.1.1/go.mod h1:QXuPeBw164PJCzCUZVmgpgHJ3Llj49jSLVkKPMtxtxA=
github.com/bsm/ginkgo/v2 v2.5.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
Expand Down
Loading
Loading