1
0
mirror of https://github.com/gfleury/go-bitbucket-v1.git synced 2025-04-09 02:58:05 -05:00

improve test

This commit is contained in:
mlosicki 2022-01-24 01:01:54 +01:00
parent 4880bdf0b7
commit b5aee2ce51

@ -2365,14 +2365,53 @@ func TestDefaultApiService_GetBranchesPagination(t *testing.T) {
context.TODO(), context.TODO(),
NewConfiguration(ts.URL), NewConfiguration(ts.URL),
) )
_, err := client.DefaultApi.GetBranches("PROJECT", "REPO", map[string]interface{}{ type fields struct {
client *APIClient
}
type args struct {
project string
repository string
localVarOptionals map[string]interface{}
}
tests := []struct {
name string
fields fields
args args
want *APIResponse
wantErr, integrationTest bool
}{
{"limitAndStartSet", fields{client: client}, args{
project: "PROJECT", repository: "REPO",
localVarOptionals: map[string]interface{}{
"limit": 100, "limit": 100,
"start": 0, "start": 0,
}) }}, nil, false, false},
if err != nil { {"incorrectLimit", fields{client: client}, args{
t.Errorf("DefaultApiService.GetBranches() error = %v", err) project: "PROJECT", repository: "REPO",
localVarOptionals: map[string]interface{}{
"limit": "wrong",
}}, nil, true, false},
{"incorrectStart", fields{client: client}, args{
project: "PROJECT", repository: "REPO",
localVarOptionals: map[string]interface{}{
"start": "wrong",
}}, nil, true, false},
}
for _, tt := range tests {
if tt.integrationTest != runIntegrationTests {
continue
}
t.Run(tt.name, func(t *testing.T) {
a := &DefaultApiService{
client: tt.fields.client,
}
_, err := a.GetBranches(tt.args.project, tt.args.repository, tt.args.localVarOptionals)
if (err != nil) != tt.wantErr {
t.Errorf("DefaultApiService.GetBranches() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
})
}
} }
func TestDefaultApiService_GetChanges(t *testing.T) { func TestDefaultApiService_GetChanges(t *testing.T) {