Skip to content

Commit

Permalink
fix: update tests in seeder
Browse files Browse the repository at this point in the history
interrupt error caused no coverage to be generated
  • Loading branch information
dnitsch committed Feb 13, 2023
1 parent a2f0e73 commit 3ceb1d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
12 changes: 5 additions & 7 deletions seeder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ basic1:
Strategy is a setting against which to perform one or more rest calls to ensure an idempotent update.
The top level `seed` can contain multiple blo
The top level `seed` can contain multiple blocks of the below type - `RestAction`

```yaml
# the name of the Action is the property itself
Expand All @@ -65,10 +65,6 @@ find-put-post-not-found-id:
someId: "$.array[?(@.name=='fubar')].id"
```

runtimeVariables:
trustedcertificategroups_id: "$.id"
highavailabilityprofiles_id: "$.id"

Each Strategy option is defined below, and can be extended.

### `GET/POST`
Expand Down Expand Up @@ -230,10 +226,12 @@ action2:
someId: "$.array[?(@.name=='fubar')].id"
```

### Contribution
## Contribution

...

Todo fill me out

...
standard go styling and contribution guide lines

standard go styling and contribution guide lines
6 changes: 3 additions & 3 deletions seeder/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func TestCustomToken(t *testing.T) {
t.Run(name, func(t *testing.T) {
got, err := tt.customAuth(t).Token(context.TODO(), tt.client(t), log.New(&bytes.Buffer{}, log.DebugLvl))
if err != nil {
t.Errorf(testutils.TestPhrase, got, tt.expect)
t.Errorf(TestPhrase, got, tt.expect)
}
if got.TokenValue != tt.expect.TokenValue {
t.Errorf(testutils.TestPhraseWithContext, "custom token not returned properly", got.TokenValue, tt.expect.TokenValue)
t.Errorf(TestPhraseWithContext, "custom token not returned properly", got.TokenValue, tt.expect.TokenValue)
}
})
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestClientCredentials(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := seeder.NewAuth(tt.am)
if got == nil {
t.Errorf(testutils.TestPhraseWithContext, "auth map", "not nil", "<nil>")
t.Errorf(TestPhraseWithContext, "auth map", "not nil", "<nil>")
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions seeder/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ func Test_findByPathExpression(t *testing.T) {
got, err := r.FindPathByExpression(tt.payload, tt.pathExpression)
if err != nil {
if err.Error() != tt.expect {
t.Errorf(testutils.TestPhrase, err, tt.expect)
t.Errorf(TestPhrase, err, tt.expect)
}
return
}

if got != tt.expect {
t.Errorf(testutils.TestPhrase, got, tt.expect)
t.Errorf(TestPhrase, got, tt.expect)
}

})
Expand Down Expand Up @@ -109,7 +109,7 @@ func Test_templatePayload(t *testing.T) {

got := tt.rest.TemplatePayload(tt.payload, tt.variables)
if got != tt.expect {
t.Errorf(testutils.TestPhrase, got, tt.expect)
t.Errorf(TestPhrase, got, tt.expect)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions seeder/seeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestExecute(t *testing.T) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Write([]byte(`{"name":"fubar","id":"1234"}`))
})
mux.HandleFunc("/token", testutils.TokenHandleFunc(t))
mux.HandleFunc("/token", TokenHandleFunc(t))
return mux
},
expect: func(url string) error {
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestExecute(t *testing.T) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Write([]byte(`{"name":"fubar","id":"1234"}`))
})
mux.HandleFunc("/token", testutils.OAuthPasswordHandleFunc(t))
mux.HandleFunc("/token", OAuthPasswordHandleFunc(t))
return mux
},
expect: func(url string) error {
Expand Down

0 comments on commit 3ceb1d1

Please sign in to comment.