Skip to content

Commit 1713871

Browse files
committed
Including basic test
1 parent f350c54 commit 1713871

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

default_api_test.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestDefaultApiService_AddUserToGroups(t *testing.T) {
124124
client *APIClient
125125
}
126126
type args struct {
127-
name string
127+
name string
128128
groups []string
129129
}
130130
tests := []struct {
@@ -1849,6 +1849,45 @@ func TestDefaultApiService_EnableHook_4(t *testing.T) {
18491849
}
18501850
}
18511851

1852+
func TestDefaultApiService_EnableHook_4_WithOptions(t *testing.T) {
1853+
type fields struct {
1854+
client *APIClient
1855+
}
1856+
type args struct {
1857+
projectKey string
1858+
hookKey string
1859+
localVarOptionals map[string]interface{}
1860+
localVarPostBody map[string]interface{}
1861+
}
1862+
tests := []struct {
1863+
name string
1864+
fields fields
1865+
args args
1866+
want *APIResponse
1867+
wantErr, integrationTest bool
1868+
}{
1869+
{"networkErrorContextExceeded", fields{client: generateConfigFake()}, args{}, &APIResponse{Message: "Put https://stash.domain.com/rest/api/1.0/projects//settings/hooks//enabled: context canceled"}, true, false},
1870+
}
1871+
for _, tt := range tests {
1872+
if tt.integrationTest != runIntegrationTests {
1873+
continue
1874+
}
1875+
t.Run(tt.name, func(t *testing.T) {
1876+
a := &DefaultApiService{
1877+
client: tt.fields.client,
1878+
}
1879+
got, err := a.EnableHook_4_WithOptions(tt.args.projectKey, tt.args.hookKey, tt.args.localVarOptionals, tt.args.localVarPostBody)
1880+
if (err != nil) != tt.wantErr {
1881+
t.Errorf("DefaultApiService.EnableHook_4_WithOptions() error = %v, wantErr %v", err, tt.wantErr)
1882+
return
1883+
}
1884+
if !reflect.DeepEqual(got, tt.want) {
1885+
t.Errorf("DefaultApiService.EnableHook_4_WithOptions() = %v, want %v", got, tt.want)
1886+
}
1887+
})
1888+
}
1889+
}
1890+
18521891
func TestDefaultApiService_FindGroupsForUser(t *testing.T) {
18531892
type fields struct {
18541893
client *APIClient

0 commit comments

Comments
 (0)