From b7cea766df006074227d3356c657a578fc819bb9 Mon Sep 17 00:00:00 2001 From: Matt Fellows Date: Tue, 20 Mar 2018 08:38:02 +1100 Subject: [PATCH] fix(utf8): revert utf8 tests until feature fixed --- .../consumer/goconsumer/user_service_test.go | 6 +++-- examples/gin/provider/user_service.go | 6 ++--- examples/gin/provider/user_service_test.go | 22 +++++++++++++------ examples/go-kit/provider/user_service.go | 6 ++--- examples/go-kit/provider/user_service_test.go | 22 +++++++++++++------ examples/mux/provider/user_service.go | 4 ++-- examples/mux/provider/user_service_test.go | 22 +++++++++++++------ 7 files changed, 57 insertions(+), 31 deletions(-) diff --git a/examples/consumer/goconsumer/user_service_test.go b/examples/consumer/goconsumer/user_service_test.go index e0f39686b..249d066fc 100644 --- a/examples/consumer/goconsumer/user_service_test.go +++ b/examples/consumer/goconsumer/user_service_test.go @@ -24,7 +24,9 @@ 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 = "Jean-Marie de La Beaujardière😀😍" +var name = "billy" var like = dsl.Like var eachLike = dsl.EachLike var term = dsl.Term @@ -77,7 +79,7 @@ func setup() { // Login form values form = url.Values{} - form.Add("username", name) + form.Add("username", "billy") form.Add("password", "issilly") // Create a request to pass to our handler. diff --git a/examples/gin/provider/user_service.go b/examples/gin/provider/user_service.go index 2e5dc679b..c3a1340ec 100644 --- a/examples/gin/provider/user_service.go +++ b/examples/gin/provider/user_service.go @@ -15,9 +15,9 @@ type Login struct { var userRepository = &types.UserRepository{ Users: map[string]*types.User{ - "Jean-Marie de La Beaujardière😀😍": &types.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + "billy": &types.User{ + Name: "billy", + Username: "billy", Password: "issilly", Type: "admin", }, diff --git a/examples/gin/provider/user_service_test.go b/examples/gin/provider/user_service_test.go index 3d956dcf7..c1b256841 100644 --- a/examples/gin/provider/user_service_test.go +++ b/examples/gin/provider/user_service_test.go @@ -14,7 +14,7 @@ import ( ) // The actual Provider test itself -func TestPact_GinProvider(t *testing.T) { +func TestPact_Provider(t *testing.T) { go startInstrumentedProvider() pact := createPact() @@ -69,6 +69,14 @@ func TestPact_GinProvider(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() { @@ -103,9 +111,9 @@ var port, _ = utils.GetFreePort() // Provider States data sets var billyExists = &examples.UserRepository{ Users: map[string]*examples.User{ - "Jean-Marie de La Beaujardière😀😍": &examples.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + "billy": &examples.User{ + Name: "billy", + Username: "billy", Password: "issilly", Type: "admin", }, @@ -116,9 +124,9 @@ var billyDoesNotExist = &examples.UserRepository{} var billyUnauthorized = &examples.UserRepository{ Users: map[string]*examples.User{ - "Jean-Marie de La Beaujardière😀😍": &examples.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + "billy": &examples.User{ + Name: "billy", + Username: "billy", Password: "issilly1", Type: "blocked", }, diff --git a/examples/go-kit/provider/user_service.go b/examples/go-kit/provider/user_service.go index 16fa72b10..99e083137 100644 --- a/examples/go-kit/provider/user_service.go +++ b/examples/go-kit/provider/user_service.go @@ -35,9 +35,9 @@ func NewInmemService() Service { return &userService{ userDatabase: &UserRepository{ users: map[string]*User{ - "Jean-Marie de La Beaujardière😀😍": &User{ - Name: "Jean-Marie de La Beaujardière😀😍", - username: "Jean-Marie de La Beaujardière😀😍", + "billy": &User{ + Name: "billy", + username: "billy", password: "issilly", Type: "admin", }, diff --git a/examples/go-kit/provider/user_service_test.go b/examples/go-kit/provider/user_service_test.go index cb2a282a2..8061afa0e 100644 --- a/examples/go-kit/provider/user_service_test.go +++ b/examples/go-kit/provider/user_service_test.go @@ -29,9 +29,9 @@ var port, _ = utils.GetFreePort() // Provider States data sets var billyExists = &UserRepository{ users: map[string]*User{ - "Jean-Marie de La Beaujardière😀😍": &User{ - Name: "Jean-Marie de La Beaujardière😀😍", - username: "Jean-Marie de La Beaujardière😀😍", + "billy": &User{ + Name: "billy", + username: "billy", password: "issilly", Type: "admin", }, @@ -42,9 +42,9 @@ var billyDoesNotExist = &UserRepository{} var billyUnauthorized = &UserRepository{ users: map[string]*User{ - "Jean-Marie de La Beaujardière😀😍": &User{ - Name: "Jean-Marie de La Beaujardière😀😍", - username: "Jean-Marie de La Beaujardière😀😍", + "billy": &User{ + Name: "billy", + username: "billy", password: "issilly1", Type: "blocked", }, @@ -52,7 +52,7 @@ var billyUnauthorized = &UserRepository{ } // The actual Provider test itself -func TestPact_GoKitProvider(t *testing.T) { +func TestPact_Provider(t *testing.T) { go startInstrumentedProvider() pact := createPact() @@ -107,6 +107,14 @@ func TestPact_GoKitProvider(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{ diff --git a/examples/mux/provider/user_service.go b/examples/mux/provider/user_service.go index f7e19a84e..47b176bd1 100644 --- a/examples/mux/provider/user_service.go +++ b/examples/mux/provider/user_service.go @@ -11,8 +11,8 @@ import ( var userRepository = &types.UserRepository{ Users: map[string]*types.User{ "billy": &types.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + Name: "billy", + Username: "billy", Password: "issilly", }, }, diff --git a/examples/mux/provider/user_service_test.go b/examples/mux/provider/user_service_test.go index 18769bda3..1954071dd 100644 --- a/examples/mux/provider/user_service_test.go +++ b/examples/mux/provider/user_service_test.go @@ -18,7 +18,7 @@ import ( ) // The actual Provider test itself -func TestPact_MuxProvider(t *testing.T) { +func TestPact_Provider(t *testing.T) { go startInstrumentedProvider() pact := createPact() @@ -73,6 +73,14 @@ func TestPact_MuxProvider(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() { @@ -129,9 +137,9 @@ var port, _ = utils.GetFreePort() // Provider States data sets var billyExists = &examples.UserRepository{ Users: map[string]*examples.User{ - "Jean-Marie de La Beaujardière😀😍": &examples.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + "billy": &examples.User{ + Name: "billy", + Username: "billy", Password: "issilly", Type: "admin", }, @@ -142,9 +150,9 @@ var billyDoesNotExist = &examples.UserRepository{} var billyUnauthorized = &examples.UserRepository{ Users: map[string]*examples.User{ - "Jean-Marie de La Beaujardière😀😍": &examples.User{ - Name: "Jean-Marie de La Beaujardière😀😍", - Username: "Jean-Marie de La Beaujardière😀😍", + "billy": &examples.User{ + Name: "billy", + Username: "billy", Password: "issilly1", Type: "blocked", },