fix tests

This commit is contained in:
Maxim Sukharev 2019-10-17 16:49:45 +02:00
parent 2fb91eb1ff
commit 55e1fce0e0

View File

@ -2794,6 +2794,7 @@ func TestDefaultApiService_GetProject(t *testing.T) {
} }
type args struct { type args struct {
ctx context.Context ctx context.Context
key string
} }
tests := []struct { tests := []struct {
name string name string
@ -2802,14 +2803,14 @@ func TestDefaultApiService_GetProject(t *testing.T) {
want *APIResponse want *APIResponse
wantErr bool wantErr bool
}{ }{
{"networkErrorContextExceeded", fields{client: generateConfigFake()}, args{}, &APIResponse{Message: "Get https://stash.domain.com/rest/api/1.0/projects/%7BprojectKey%7D: context canceled"}, true}, {"networkErrorContextExceeded", fields{client: generateConfigFake()}, args{key: "7BprojectKey"}, &APIResponse{Message: "Get https://stash.domain.com/rest/api/1.0/projects/7BprojectKey: context canceled"}, true},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
a := &DefaultApiService{ a := &DefaultApiService{
client: tt.fields.client, client: tt.fields.client,
} }
got, err := a.GetProject(tt.args.ctx) got, err := a.GetProject(tt.args.ctx, tt.args.key)
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {
t.Errorf("DefaultApiService.GetProject() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("DefaultApiService.GetProject() error = %v, wantErr %v", err, tt.wantErr)
return return