generated from mrz1836/go-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(BUX-223): replace current router with gin
- Loading branch information
1 parent
37dda37
commit 7a262c9
Showing
82 changed files
with
1,703 additions
and
1,705 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package accesskeys | ||
|
||
import "github.com/bitcoin-sv/spv-wallet/engine" | ||
|
||
type CreateAccessKey struct { | ||
Metadata engine.Metadata `json:"metadata"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
package accesskeys | ||
|
||
import ( | ||
"net/http" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
|
||
"github.com/bitcoin-sv/spv-wallet/config" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestBaseRegisterRoutes will test routes | ||
func (ts *TestSuite) TestRegisterRoutes() { | ||
ts.T().Run("test routes", func(t *testing.T) { | ||
|
||
// gey key | ||
handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodGet, "/"+config.APIVersion+"/access-key") | ||
assert.NotNil(t, handle) | ||
|
||
// search key | ||
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/"+config.APIVersion+"/access-key/search") | ||
assert.NotNil(t, handle) | ||
|
||
// search key | ||
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPost, "/"+config.APIVersion+"/access-key/search") | ||
assert.NotNil(t, handle) | ||
|
||
// create key | ||
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPost, "/"+config.APIVersion+"/access-key") | ||
assert.NotNil(t, handle) | ||
|
||
// delete key | ||
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodDelete, "/"+config.APIVersion+"/access-key") | ||
assert.NotNil(t, handle) | ||
testCases := []struct { | ||
method string | ||
url string | ||
}{ | ||
{"GET", "/" + config.APIVersion + "/access-key"}, | ||
{"POST", "/" + config.APIVersion + "/access-key"}, | ||
{"DELETE", "/" + config.APIVersion + "/access-key"}, | ||
{"POST", "/" + config.APIVersion + "/access-key/search"}, | ||
{"GET", "/" + config.APIVersion + "/access-key/search"}, | ||
} | ||
|
||
ts.Router.Routes() | ||
|
||
for _, testCase := range testCases { | ||
found := false | ||
for _, routeInfo := range ts.Router.Routes() { | ||
if testCase.url == routeInfo.Path && testCase.method == routeInfo.Method { | ||
assert.NotNil(t, routeInfo.HandlerFunc) | ||
found = true | ||
break | ||
} | ||
} | ||
assert.True(t, found) | ||
} | ||
}) | ||
} |
Oops, something went wrong.