-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hooks): add RequestFilter and StateHandlers to DSL
Adds the ability to intercept requests to/from the provider in order to deal with more complex scenarios (such as testing OAuth tokens with time-bound scopes). Additionally, removes the need for a "setup" endpoint, in favour of passing functions keyed by the states they setup. - New fields to DSL - Deprecate the ProviderStatesSetupURL - Add new proxy package, containing the reverse proxy and middleware types - Update test coverage for existing types
- Loading branch information
Showing
24 changed files
with
739 additions
and
58 deletions.
There are no files selected for viewing
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,16 @@ | ||
package client | ||
|
||
import "testing" | ||
|
||
func TestMessageService_NewService(t *testing.T) { | ||
s := &MessageService{} | ||
svc := s.NewService([]string{"--foo"}) | ||
|
||
if svc == nil { | ||
t.Fatalf("Expected a non-nil object but got nil") | ||
} | ||
|
||
if s.Args[0] != "--foo" { | ||
t.Fatalf("Expected '--foo' argument to be passed") | ||
} | ||
} |
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,30 @@ | ||
package dsl | ||
|
||
import "testing" | ||
|
||
func TestVerifyMessageRequest_Valid(t *testing.T) { | ||
r := VerifyMessageRequest{ | ||
PactURLs: []string{ | ||
"http://localhost:1234", | ||
}, | ||
BrokerPassword: "user", | ||
BrokerUsername: "pass", | ||
ProviderVersion: "1.0.0", | ||
PublishVerificationResults: true, | ||
} | ||
|
||
err := r.Validate() | ||
|
||
if err != nil { | ||
t.Fatal("want nil, got err: ", err) | ||
} | ||
} | ||
func TestVerifyMessageRequest_Invalid(t *testing.T) { | ||
r := VerifyMessageRequest{} | ||
|
||
err := r.Validate() | ||
|
||
if err == nil { | ||
t.Fatal("want error, got nil") | ||
} | ||
} |
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
Oops, something went wrong.