File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
samples/client/petstore/go Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "testing"
5
+
6
+ sw "./swagger"
7
+ )
8
+
9
+ func TestAddPet (t * testing.T ) {
10
+ t .Log ("Testing TestAddPet..." )
11
+ s := sw .NewPetApi ()
12
+ newPet := (sw.Pet {Id : 12830 , Name : "gopher" ,
13
+ PhotoUrls : []string {"http://1.com" , "http://2.com" }, Status : "pending" })
14
+
15
+ err := s .AddPet (newPet )
16
+
17
+ if err != nil {
18
+ t .Errorf ("Error while adding pet" )
19
+ t .Log (err )
20
+ }
21
+ }
22
+
23
+ func TestGetPetById (t * testing.T ) {
24
+ t .Log ("Testing TestGetPetById..." )
25
+
26
+ s := sw .NewPetApi ()
27
+ resp , err := s .GetPetById (12830 )
28
+ if err != nil {
29
+ t .Errorf ("Error while getting pet by id" )
30
+ t .Log (err )
31
+ } else {
32
+ t .Log (resp )
33
+ }
34
+ }
35
+
36
+ func TestUpdatePetWithForm (t * testing.T ) {
37
+ t .Log ("Testing UpdatePetWithForm..." )
38
+
39
+ s := sw .NewPetApi ()
40
+
41
+ err := s .UpdatePetWithForm ("12830" , "golang" , "available" )
42
+
43
+ if err != nil {
44
+ t .Errorf ("Error while updating pet by id" )
45
+ t .Log (err )
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments