@@ -11,13 +11,26 @@ import (
11
11
apiClient "github.com/go-openapi/runtime/client"
12
12
"github.com/go-openapi/strfmt"
13
13
apiContext "github.com/netlify/open-api/go/porcelain/context"
14
+ "github.com/stretchr/testify/assert"
14
15
"github.com/stretchr/testify/require"
15
16
)
16
17
17
18
func TestListFormsBySiteId (t * testing.T ) {
18
19
server := httptest .NewServer (http .HandlerFunc (func (rw http.ResponseWriter , req * http.Request ) {
19
20
rw .Header ().Set ("Content-Type" , "application/json; charset=utf-8" )
20
- rw .Write ([]byte (`[]` ))
21
+ rw .Write ([]byte (`
22
+ [
23
+ {
24
+ "id": "1",
25
+ "site_id": "123",
26
+ "name": "contact",
27
+ "paths": [],
28
+ "submission_count": 0,
29
+ "fields": [],
30
+ "created_at": ""
31
+ }
32
+ ]` ))
33
+ assert .Equal (t , "/api/v1/sites/123/forms" , req .URL .String ())
21
34
}))
22
35
defer server .Close ()
23
36
@@ -33,6 +46,7 @@ func TestListFormsBySiteId(t *testing.T) {
33
46
require .NoError (t , err )
34
47
tr := apiClient .NewWithClient (parsedURL .Host , "/api/v1" , []string {"http" }, httpClient )
35
48
client := NewRetryable (tr , strfmt .Default , 1 )
36
- _ , err = client .ListFormsBySiteId (apiContext .WithAuthInfo (context .Background (), authInfo ), "123" )
49
+ forms , err : = client .ListFormsBySiteId (apiContext .WithAuthInfo (context .Background (), authInfo ), "123" )
37
50
require .NoError (t , err )
51
+ assert .Equal (t , len (forms ), 1 )
38
52
}
0 commit comments