Skip to content

Commit

Permalink
Merge pull request #54 from stripe/brandur-send-path
Browse files Browse the repository at this point in the history
Send valid path to generator while running test suite
  • Loading branch information
brandur-stripe committed Mar 30, 2018
2 parents 1644ab8 + 8867753 commit 07a7a9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestValidFixtures(t *testing.T) {

// Tests that DataGenerator can generate an example of the given schema, and
// that the example validates against the schema correctly
func testCanGenerate(t *testing.T, schema *spec.Schema, expand bool) {
func testCanGenerate(t *testing.T, path spec.Path, schema *spec.Schema, expand bool) {
assert.NotNil(t, schema)

generator := DataGenerator{
Expand All @@ -196,7 +196,7 @@ func testCanGenerate(t *testing.T, schema *spec.Schema, expand bool) {
var example interface{}
var err error
assert.NotPanics(t, func() {
example, err = generator.Generate(schema, "<test request path>", expansions)
example, err = generator.Generate(schema, string(path), expansions)
})
assert.NoError(t, err)

Expand All @@ -218,7 +218,7 @@ func TestResourcesCanBeGenerated(t *testing.T) {
schema := operation.Responses[spec.StatusCode("200")].Content["application/json"].Schema
t.Run(
fmt.Sprintf("%s %s (without expansions)", method, url),
func(t2 *testing.T) { testCanGenerate(t2, schema, false) },
func(t2 *testing.T) { testCanGenerate(t2, url, schema, false) },
)
}
}
Expand All @@ -232,7 +232,7 @@ func TestResourcesCanBeGeneratedAndExpanded(t *testing.T) {
schema := operation.Responses[spec.StatusCode("200")].Content["application/json"].Schema
t.Run(
fmt.Sprintf("%s %s (with expansions)", method, url),
func(t2 *testing.T) { testCanGenerate(t2, schema, true) },
func(t2 *testing.T) { testCanGenerate(t2, url, schema, true) },
)
}
}
Expand Down

0 comments on commit 07a7a9d

Please sign in to comment.