Skip to content

Commit 7885d39

Browse files
committed
fix some tests
1 parent d396676 commit 7885d39

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

src/webserver_test.go

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,52 +34,197 @@ func TestFakeToUpCodeCoverage(t *testing.T) {
3434
tibiaCharactersCharacterV3(c)
3535
assert.Equal(http.StatusOK, w.Code)
3636

37+
w = httptest.NewRecorder()
38+
c, _ = gin.CreateTestContext(w)
39+
3740
tibiaCreaturesOverviewV3(c)
3841
assert.Equal(http.StatusOK, w.Code)
3942

43+
w = httptest.NewRecorder()
44+
c, _ = gin.CreateTestContext(w)
45+
46+
c.Params = []gin.Param{
47+
{
48+
Key: "race",
49+
Value: "demon",
50+
},
51+
}
52+
4053
tibiaCreaturesCreatureV3(c)
4154
assert.Equal(http.StatusOK, w.Code)
4255

56+
w = httptest.NewRecorder()
57+
c, _ = gin.CreateTestContext(w)
58+
4359
tibiaFansitesV3(c)
4460
assert.Equal(http.StatusOK, w.Code)
4561

62+
w = httptest.NewRecorder()
63+
c, _ = gin.CreateTestContext(w)
64+
65+
c.Params = []gin.Param{
66+
{
67+
Key: "name",
68+
Value: "pax",
69+
},
70+
}
71+
4672
tibiaGuildsGuildV3(c)
4773
assert.Equal(http.StatusOK, w.Code)
4874

75+
w = httptest.NewRecorder()
76+
c, _ = gin.CreateTestContext(w)
77+
78+
c.Params = []gin.Param{
79+
{
80+
Key: "world",
81+
Value: "antica",
82+
},
83+
}
84+
4985
tibiaGuildsOverviewV3(c)
5086
assert.Equal(http.StatusOK, w.Code)
5187

88+
w = httptest.NewRecorder()
89+
c, _ = gin.CreateTestContext(w)
90+
91+
c.Params = []gin.Param{
92+
{
93+
Key: "world",
94+
Value: "antica",
95+
},
96+
{
97+
Key: "category",
98+
Value: "experience",
99+
},
100+
{
101+
Key: "vocation",
102+
Value: "sorcerer",
103+
},
104+
}
105+
52106
tibiaHighscoresV3(c)
53107
assert.Equal(http.StatusOK, w.Code)
54108

109+
w = httptest.NewRecorder()
110+
c, _ = gin.CreateTestContext(w)
111+
112+
c.Params = []gin.Param{
113+
{
114+
Key: "world",
115+
Value: "antica",
116+
},
117+
{
118+
Key: "house_id",
119+
Value: "59054",
120+
},
121+
}
122+
55123
tibiaHousesHouseV3(c)
56124
assert.Equal(http.StatusOK, w.Code)
57125

126+
w = httptest.NewRecorder()
127+
c, _ = gin.CreateTestContext(w)
128+
129+
c.Params = []gin.Param{
130+
{
131+
Key: "world",
132+
Value: "antica",
133+
},
134+
{
135+
Key: "town",
136+
Value: "venore",
137+
},
138+
}
139+
58140
tibiaHousesOverviewV3(c)
59141
assert.Equal(http.StatusOK, w.Code)
60142

143+
w = httptest.NewRecorder()
144+
c, _ = gin.CreateTestContext(w)
145+
146+
c.Params = []gin.Param{
147+
{
148+
Key: "world",
149+
Value: "antica",
150+
},
151+
}
152+
61153
tibiaKillstatisticsV3(c)
62154
assert.Equal(http.StatusOK, w.Code)
63155

64156
assert.False(false, tibiaNewslistArchiveV3())
65157
assert.False(false, tibiaNewslistArchiveDaysV3())
66158
assert.False(false, tibiaNewslistLatestV3())
67159

160+
w = httptest.NewRecorder()
161+
c, _ = gin.CreateTestContext(w)
162+
163+
c.Params = []gin.Param{
164+
{
165+
Key: "days",
166+
Value: "90",
167+
},
168+
}
169+
68170
tibiaNewslistV3(c)
69171
assert.Equal(http.StatusOK, w.Code)
70172

173+
w = httptest.NewRecorder()
174+
c, _ = gin.CreateTestContext(w)
175+
176+
c.Params = []gin.Param{
177+
{
178+
Key: "news_id",
179+
Value: "6607",
180+
},
181+
}
182+
71183
tibiaNewsV3(c)
72184
assert.Equal(http.StatusOK, w.Code)
73185

186+
w = httptest.NewRecorder()
187+
c, _ = gin.CreateTestContext(w)
188+
189+
c.Params = []gin.Param{
190+
{
191+
Key: "vocation",
192+
Value: "sorcerer",
193+
},
194+
}
195+
74196
tibiaSpellsOverviewV3(c)
75197
assert.Equal(http.StatusOK, w.Code)
76198

199+
w = httptest.NewRecorder()
200+
c, _ = gin.CreateTestContext(w)
201+
202+
c.Params = []gin.Param{
203+
{
204+
Key: "spell_id",
205+
Value: "exori",
206+
},
207+
}
208+
77209
tibiaSpellsSpellV3(c)
78210
assert.Equal(http.StatusOK, w.Code)
79211

212+
w = httptest.NewRecorder()
213+
c, _ = gin.CreateTestContext(w)
214+
80215
tibiaWorldsOverviewV3(c)
81216
assert.Equal(http.StatusOK, w.Code)
82217

218+
w = httptest.NewRecorder()
219+
c, _ = gin.CreateTestContext(w)
220+
221+
c.Params = []gin.Param{
222+
{
223+
Key: "name",
224+
Value: "antica",
225+
},
226+
}
227+
83228
tibiaWorldsWorldV3(c)
84229
assert.Equal(http.StatusOK, w.Code)
85230

@@ -89,6 +234,9 @@ func TestFakeToUpCodeCoverage(t *testing.T) {
89234
T string `json:"t"`
90235
}
91236

237+
w = httptest.NewRecorder()
238+
c, _ = gin.CreateTestContext(w)
239+
92240
TibiaDataAPIHandleResponse(c, "", test{T: "abc"})
93241
assert.Equal(http.StatusOK, w.Code)
94242
}

0 commit comments

Comments
 (0)