Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
buger committed Jun 4, 2018
1 parent 9799c67 commit d3dcb35
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion coprocess_grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func newTestGRPCServer() (s *grpc.Server) {
func loadTestGRPCSpec() *APISpec {
spec := buildAndLoadAPI(func(spec *APISpec) {
spec.APIID = "999999"
spec.OrgID = "default"
spec.OrgID = mockOrgID
spec.Auth = apidef.Auth{
AuthHeaderName: "authorization",
}
Expand Down
6 changes: 2 additions & 4 deletions coprocess_id_extractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
)

const (
extractorTestOrgID = "testorg"

extractorValueInput = "testkey"

extractorRegexExpr = "prefix-(.*)"
Expand All @@ -41,7 +39,7 @@ func createSpecTestFrom(t testing.TB, def *apidef.APIDefinition) *APISpec {

func prepareExtractor(t testing.TB, extractorSource apidef.IdExtractorSource, extractorType apidef.IdExtractorType, config map[string]interface{}) (IdExtractor, *APISpec) {
def := &apidef.APIDefinition{
OrgID: extractorTestOrgID,
OrgID: mockOrgID,
CustomMiddleware: apidef.MiddlewareSection{
IdExtractor: apidef.MiddlewareIdExtractor{
ExtractFrom: extractorSource,
Expand Down Expand Up @@ -87,7 +85,7 @@ func prepareExtractorFormRequest(values map[string]string) *http.Request {
func generateSessionID(input string) string {
data := []byte(input)
tokenID := fmt.Sprintf("%x", md5.Sum(data))
return generateToken(extractorTestOrgID, tokenID)
return generateToken(mockOrgID, tokenID)
}

func TestValueExtractor(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var (
)

const defaultListenPort = 8080
const mockOrgID = "507f1f77bcf86cd799439011"

var defaultTestConfig config.Config
var testServerRouter *mux.Router
Expand Down

0 comments on commit d3dcb35

Please sign in to comment.