Skip to content

Commit

Permalink
Showing 7 changed files with 31 additions and 57 deletions.
6 changes: 2 additions & 4 deletions examples/consumer/goconsumer/user_service_test.go
Original file line number Diff line number Diff line change
@@ -24,9 +24,7 @@ var pact dsl.Pact
var form url.Values
var rr http.ResponseWriter
var req *http.Request

// var name = "Jean-Marie de La Beaujardière😀😍"
var name = "billy"
var name = "Jean-Marie de La Beaujardière😀😍"
var like = dsl.Like
var eachLike = dsl.EachLike
var term = dsl.Term
@@ -79,7 +77,7 @@ func setup() {

// Login form values
form = url.Values{}
form.Add("username", "billy")
form.Add("username", name)
form.Add("password", "issilly")

// Create a request to pass to our handler.
6 changes: 3 additions & 3 deletions examples/gin/provider/user_service.go
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@ type Login struct {

var userRepository = &types.UserRepository{
Users: map[string]*types.User{
"billy": &types.User{
Name: "billy",
Username: "billy",
"Jean-Marie de La Beaujardière😀😍": &types.User{
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly",
Type: "admin",
},
22 changes: 7 additions & 15 deletions examples/gin/provider/user_service_test.go
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import (
)

// The actual Provider test itself
func TestPact_Provider(t *testing.T) {
func TestPact_GinProvider(t *testing.T) {
go startInstrumentedProvider()

pact := createPact()
@@ -69,14 +69,6 @@ func TestPact_Provider(t *testing.T) {
}
}

func assertExamples(t *testing.T, r types.ProviderVerifierResponse) {
for _, example := range r.Examples {
if example.Status != "passed" {
t.Errorf("%s\n%s\n", example.FullDescription, example.Exception.Message)
}
}
}

// Starts the provider API with hooks for provider states.
// This essentially mirrors the main.go file, with extra routes added.
func startInstrumentedProvider() {
@@ -111,9 +103,9 @@ var port, _ = utils.GetFreePort()
// Provider States data sets
var billyExists = &examples.UserRepository{
Users: map[string]*examples.User{
"billy": &examples.User{
Name: "billy",
Username: "billy",
"Jean-Marie de La Beaujardière😀😍": &examples.User{
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly",
Type: "admin",
},
@@ -124,9 +116,9 @@ var billyDoesNotExist = &examples.UserRepository{}

var billyUnauthorized = &examples.UserRepository{
Users: map[string]*examples.User{
"billy": &examples.User{
Name: "billy",
Username: "billy",
"Jean-Marie de La Beaujardière😀😍": &examples.User{
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly1",
Type: "blocked",
},
6 changes: 3 additions & 3 deletions examples/go-kit/provider/user_service.go
Original file line number Diff line number Diff line change
@@ -35,9 +35,9 @@ func NewInmemService() Service {
return &userService{
userDatabase: &UserRepository{
users: map[string]*User{
"billy": &User{
Name: "billy",
username: "billy",
"Jean-Marie de La Beaujardière😀😍": &User{
Name: "Jean-Marie de La Beaujardière😀😍",
username: "Jean-Marie de La Beaujardière😀😍",
password: "issilly",
Type: "admin",
},
22 changes: 7 additions & 15 deletions examples/go-kit/provider/user_service_test.go
Original file line number Diff line number Diff line change
@@ -29,9 +29,9 @@ var port, _ = utils.GetFreePort()
// Provider States data sets
var billyExists = &UserRepository{
users: map[string]*User{
"billy": &User{
Name: "billy",
username: "billy",
"Jean-Marie de La Beaujardière😀😍": &User{
Name: "Jean-Marie de La Beaujardière😀😍",
username: "Jean-Marie de La Beaujardière😀😍",
password: "issilly",
Type: "admin",
},
@@ -42,17 +42,17 @@ var billyDoesNotExist = &UserRepository{}

var billyUnauthorized = &UserRepository{
users: map[string]*User{
"billy": &User{
Name: "billy",
username: "billy",
"Jean-Marie de La Beaujardière😀😍": &User{
Name: "Jean-Marie de La Beaujardière😀😍",
username: "Jean-Marie de La Beaujardière😀😍",
password: "issilly1",
Type: "blocked",
},
},
}

// The actual Provider test itself
func TestPact_Provider(t *testing.T) {
func TestPact_GoKitProvider(t *testing.T) {
go startInstrumentedProvider()

pact := createPact()
@@ -107,14 +107,6 @@ func TestPact_Provider(t *testing.T) {
}
}

func assertExamples(t *testing.T, r types.ProviderVerifierResponse) {
for _, example := range r.Examples {
if example.Status != "passed" {
t.Errorf("%s\n%s\n", example.FullDescription, example.Exception.Message)
}
}
}

// Setup the Pact client.
func createPact() dsl.Pact {
return dsl.Pact{
4 changes: 2 additions & 2 deletions examples/mux/provider/user_service.go
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ import (
var userRepository = &types.UserRepository{
Users: map[string]*types.User{
"billy": &types.User{
Name: "billy",
Username: "billy",
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly",
},
},
22 changes: 7 additions & 15 deletions examples/mux/provider/user_service_test.go
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import (
)

// The actual Provider test itself
func TestPact_Provider(t *testing.T) {
func TestPact_MuxProvider(t *testing.T) {
go startInstrumentedProvider()

pact := createPact()
@@ -73,14 +73,6 @@ func TestPact_Provider(t *testing.T) {
}
}

func assertExamples(t *testing.T, r types.ProviderVerifierResponse) {
for _, example := range r.Examples {
if example.Status != "passed" {
t.Errorf("%s\n%s\n", example.FullDescription, example.Exception.Message)
}
}
}

// Starts the provider API with hooks for provider states.
// This essentially mirrors the main.go file, with extra routes added.
func startInstrumentedProvider() {
@@ -137,9 +129,9 @@ var port, _ = utils.GetFreePort()
// Provider States data sets
var billyExists = &examples.UserRepository{
Users: map[string]*examples.User{
"billy": &examples.User{
Name: "billy",
Username: "billy",
"Jean-Marie de La Beaujardière😀😍": &examples.User{
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly",
Type: "admin",
},
@@ -150,9 +142,9 @@ var billyDoesNotExist = &examples.UserRepository{}

var billyUnauthorized = &examples.UserRepository{
Users: map[string]*examples.User{
"billy": &examples.User{
Name: "billy",
Username: "billy",
"Jean-Marie de La Beaujardière😀😍": &examples.User{
Name: "Jean-Marie de La Beaujardière😀😍",
Username: "Jean-Marie de La Beaujardière😀😍",
Password: "issilly1",
Type: "blocked",
},

0 comments on commit 1ad4f8c

Please sign in to comment.