-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_test.go
37 lines (36 loc) · 1.03 KB
/
service_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
//func TestSearchTvShow(t *testing.T) {
// ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// res := TheMovieDbSearchTvResponse{
// Page: 0,
// TotalPages: 1,
// Results: []TheMovieDbTvShow{{
// PosterPath: "",
// Popularity: 0,
// Id: 1234,
// BackdropPath: "",
// VoteAverage: 0,
// Overview: "this is an overview",
// FirstAirDate: "",
// OriginalCountry: "",
// GenreIds: nil,
// OriginalLanguage: "",
// VoteCount: 0,
// Name: "This is the name",
// OriginalName: "",
// }},
// }
// w.Header().Set("Content-Type", "application/json")
// w.WriteHeader(http.StatusOK)
// _ = json.NewEncoder(w).Encode(res)
// }))
// t.Cleanup(func() {
// ts.Close()
// })
// call, _ := http.Get(ts.URL)
// res, _ := io.ReadAll(call.Body)
// var parsed TheMovieDbSearchTvResponse
// _ = json.Unmarshal(res, &parsed)
// _ = call.Body.Close()
// t.Logf("res: [%#v]", parsed)
//}