http-olympics: add tests; add '-data' flag with the path to json records; sort top athletes by name; change generated tests layout for easier testing

This commit is contained in:
Arseny Balobanov 2020-02-21 02:10:39 +03:00
parent c8e7a80e97
commit 55cb3d2b4c
277 changed files with 305 additions and 112 deletions

1
go.mod
View file

@ -3,6 +3,7 @@ module gitlab.com/slon/shad-go
go 1.13
require (
github.com/go-resty/resty/v2 v2.1.0
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
go.uber.org/goleak v1.0.0

7
go.sum
View file

@ -8,11 +8,15 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsldE=
github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
@ -47,6 +51,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -62,6 +68,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbO
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View file

@ -6,23 +6,24 @@
-> вернуть информацию по атлету с именем: откуда, сколько каких медалей выиграл всего и по годам
* /top-athletes-in-sport?sport=SSSS&limit=main_test.goK
* GET /top-athletes-in-sport?sport=SSSS&limit=main_test.goK
-> вернуть top-K (default=3) спортсменов по абсолютному числу медалей в их спортивной карьере в указанном виде спорта
-> вернуть top-K (default=3) спортсменов по абсолютному числу медалей в их спортивной карьере в указанном виде спорта
(сортируем по золотым, потом по серебрянным, потом по бронзе, потом лексикографически по имени спортсмена)
* /top-countries-in-year?year=YYYY&limit=K
* GET /top-countries-in-year?year=YYYY&limit=K
-> вернуть top-K (default=3) стран в порядке медального зачета (сортируем по золотым, потом по серебрянным, потом по бронзе, потом лексикографически по стране)
используя данные о победителях и призёрах олимпийских игр из [./testdata/olympicWInners.json](./testdata/olympicWinners.json).
Сервер должен слушать порт, переданный через аргумент `--port`.
Сервер должен слушать порт, переданный через аргумент `-port`. Путь к json'у с данными передаётся через флаг `-data`.
### Примеры
Запуск:
```
$ olympics -port 6029
$ olympics -port 6029 -data ./olympics/testdata/olympicWinners.json
```
#### athlete-info

184
olympics/main_test.go Normal file
View file

@ -0,0 +1,184 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path"
"strconv"
"testing"
"time"
"github.com/go-resty/resty/v2"
"github.com/stretchr/testify/require"
"gitlab.com/slon/shad-go/tools/testtool"
)
const importPath = "gitlab.com/slon/shad-go/olympics"
var binCache testtool.BinCache
func TestMain(m *testing.M) {
os.Exit(func() int {
var teardown testtool.CloseFunc
binCache, teardown = testtool.NewBinCache()
defer teardown()
return m.Run()
}())
}
func startServer(t *testing.T) (port string, stop func()) {
binary, err := binCache.GetBinary(importPath)
require.NoError(t, err)
port, err = testtool.GetFreePort()
require.NoError(t, err, "unable to get free port")
cmd := exec.Command(binary, "-port", port, "-data", "./testdata/olympicWinners.json")
cmd.Stdout = nil
cmd.Stderr = os.Stderr
require.NoError(t, cmd.Start())
done := make(chan error)
go func() {
done <- cmd.Wait()
}()
stop = func() {
_ = cmd.Process.Kill()
<-done
}
if err = testtool.WaitForPort(t, time.Second*5, port); err != nil {
stop()
}
require.NoError(t, err)
return
}
func TestServer_valid(t *testing.T) {
port, stop := startServer(t)
defer stop()
c := resty.New().SetTimeout(time.Second)
for _, e := range []string{"athlete-info", "top-athletes-in-sport", "top-countries-in-year"} {
t.Run(e, func(t *testing.T) {
testDir := path.Join("./testdata", "tests", e)
files, err := ioutil.ReadDir(testDir)
if err != nil {
require.NoError(t, err)
}
for _, f := range files {
if !f.IsDir() {
continue
}
if _, err := strconv.Atoi(f.Name()); err != nil {
continue
}
t.Run(f.Name(), func(t *testing.T) {
in, err := ioutil.ReadFile(path.Join(testDir, f.Name(), "in.json"))
require.NoError(t, err)
out, err := ioutil.ReadFile(path.Join(testDir, f.Name(), "out.json"))
require.NoError(t, err)
var values map[string]interface{}
require.NoError(t, json.Unmarshal(in, &values))
resp, err := c.R().
SetQueryParams(toURLValues(values)).
Get(fmt.Sprintf("http://localhost:%s/%s", port, e))
require.NoError(t, err)
require.Equal(t, http.StatusOK, resp.StatusCode())
require.Contains(t, resp.Header().Get("Content-Type"), "application/json")
require.JSONEq(t, string(out), resp.String())
})
}
})
}
}
func TestServer_invalid(t *testing.T) {
port, stop := startServer(t)
defer stop()
c := resty.New().SetTimeout(time.Second)
for _, tc := range []struct {
endpoint string
description string
queryParams map[string]string
expectedCode int
}{
{
endpoint: "athlete-info",
description: "name-not-found",
queryParams: map[string]string{
"name": "AB",
},
expectedCode: http.StatusNotFound,
},
{
endpoint: "top-athletes-in-sport",
description: "sport-not-found",
queryParams: map[string]string{
"sport": "chess",
},
expectedCode: http.StatusNotFound,
},
{
endpoint: "top-athletes-in-sport",
description: "invalid-limit",
queryParams: map[string]string{
"sport": "Canoeing",
"limit": "2.5",
},
expectedCode: http.StatusBadRequest,
},
{
endpoint: "top-countries-in-year",
description: "year-not-found",
queryParams: map[string]string{
"year": "2009",
},
expectedCode: http.StatusNotFound,
},
{
endpoint: "top-countries-in-year",
description: "invalid-limit",
queryParams: map[string]string{
"year": "2012",
"limit": "2.5",
},
expectedCode: http.StatusBadRequest,
},
} {
t.Run(tc.endpoint+"-"+tc.description, func(t *testing.T) {
resp, err := c.R().
SetQueryParams(tc.queryParams).
Get(fmt.Sprintf("http://localhost:%s/%s", port, tc.endpoint))
require.NoError(t, err)
require.Equal(t, tc.expectedCode, resp.StatusCode())
})
}
}
func toURLValues(in map[string]interface{}) map[string]string {
out := make(map[string]string)
for k, v := range in {
out[k] = fmt.Sprintf("%v", v)
}
return out
}

View file

@ -0,0 +1 @@
{"sport": "Nordic Combined", "limit": 3}

View file

@ -0,0 +1 @@
[{"athlete":"Felix Gottwald","country":"Austria","medals":{"gold":3,"silver":1,"bronze":3,"total":7},"medals_by_year":{"2002":{"gold":0,"silver":0,"bronze":3,"total":3},"2006":{"gold":2,"silver":1,"bronze":0,"total":3},"2010":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Samppa Lajunen","country":"Finland","medals":{"gold":3,"silver":0,"bronze":0,"total":3},"medals_by_year":{"2002":{"gold":3,"silver":0,"bronze":0,"total":3}}},{"athlete":"Mario Stecher","country":"Austria","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2002":{"gold":0,"silver":0,"bronze":1,"total":1},"2006":{"gold":1,"silver":0,"bronze":0,"total":1},"2010":{"gold":1,"silver":0,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Speed Skating", "limit": 2}

View file

@ -1 +0,0 @@
[{"athlete":"Claudia Pechstein","country":"Germany","medals":{"gold":3,"silver":1,"bronze":0,"total":4},"medals_by_year":{"2002":{"gold":2,"silver":0,"bronze":0,"total":2},"2006":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Anni Friesinger-Postma","country":"Germany","medals":{"gold":3,"silver":0,"bronze":1,"total":4},"medals_by_year":{"2002":{"gold":1,"silver":0,"bronze":0,"total":1},"2006":{"gold":1,"silver":0,"bronze":1,"total":2},"2010":{"gold":1,"silver":0,"bronze":0,"total":1}}}]

View file

@ -0,0 +1 @@
{"sport": "Table Tennis", "limit": 16}

View file

@ -1 +1 @@
[{"athlete":"Wang Nan","country":"China","medals":{"gold":4,"silver":1,"bronze":0,"total":5},"medals_by_year":{"2000":{"gold":2,"silver":0,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Zhang Yining","country":"China","medals":{"gold":4,"silver":0,"bronze":0,"total":4},"medals_by_year":{"2004":{"gold":2,"silver":0,"bronze":0,"total":2},"2008":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Ma Lin","country":"China","medals":{"gold":3,"silver":0,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Wang Hao","country":"China","medals":{"gold":2,"silver":3,"bronze":0,"total":5},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2},"2012":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Guo Yue","country":"China","medals":{"gold":2,"silver":0,"bronze":2,"total":4},"medals_by_year":{"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":1,"total":2},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Wang Liqin","country":"China","medals":{"gold":2,"silver":0,"bronze":2,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":1,"total":2}}},{"athlete":"Li Xiaoxia","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Zhang Jike","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}}]
[{"athlete":"Wang Nan","country":"China","medals":{"gold":4,"silver":1,"bronze":0,"total":5},"medals_by_year":{"2000":{"gold":2,"silver":0,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Zhang Yining","country":"China","medals":{"gold":4,"silver":0,"bronze":0,"total":4},"medals_by_year":{"2004":{"gold":2,"silver":0,"bronze":0,"total":2},"2008":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Ma Lin","country":"China","medals":{"gold":3,"silver":0,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Wang Hao","country":"China","medals":{"gold":2,"silver":3,"bronze":0,"total":5},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2},"2012":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Guo Yue","country":"China","medals":{"gold":2,"silver":0,"bronze":2,"total":4},"medals_by_year":{"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":1,"total":2},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Wang Liqin","country":"China","medals":{"gold":2,"silver":0,"bronze":2,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":1,"total":2}}},{"athlete":"Li Xiaoxia","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Zhang Jike","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Yu Seung-Min","country":"South Korea","medals":{"gold":1,"silver":1,"bronze":1,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":0,"bronze":1,"total":1},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Ding Ning","country":"China","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Kong Linghui","country":"China","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Li Ju","country":"China","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Chen Qi","country":"China","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Ma Long","country":"China","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Yan Sen","country":"China","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Dmitrij Ovtcharov","country":"Germany","medals":{"gold":0,"silver":1,"bronze":2,"total":3},"medals_by_year":{"2008":{"gold":0,"silver":1,"bronze":0,"total":1},"2012":{"gold":0,"silver":0,"bronze":2,"total":2}}}]

View file

@ -0,0 +1 @@
{"sport": "Archery", "limit": 9}

View file

@ -0,0 +1 @@
[{"athlete":"Park Seong-Hyeon","country":"South Korea","medals":{"gold":3,"silver":1,"bronze":0,"total":4},"medals_by_year":{"2004":{"gold":2,"silver":0,"bronze":0,"total":2},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Yun Mi-Jin","country":"South Korea","medals":{"gold":3,"silver":0,"bronze":0,"total":3},"medals_by_year":{"2000":{"gold":2,"silver":0,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Lee Seong-Jin","country":"South Korea","medals":{"gold":2,"silver":1,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":1,"bronze":0,"total":2},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Marco Galiazzo","country":"Italy","medals":{"gold":2,"silver":1,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Park Gyeong-Mo","country":"South Korea","medals":{"gold":2,"silver":1,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Im Dong-Hyeon","country":"South Korea","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"Jang Yong-Ho","country":"South Korea","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Ki Bo-Bae","country":"South Korea","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Zhang Juanjuan","country":"China","medals":{"gold":1,"silver":2,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}}]

View file

@ -1 +0,0 @@
{"sport": "Alpine Skiing", "limit": 3}

View file

@ -1 +0,0 @@
[{"athlete":"Janica Kostelic","country":"Croatia","medals":{"gold":4,"silver":2,"bronze":0,"total":6},"medals_by_year":{"2002":{"gold":3,"silver":1,"bronze":0,"total":4},"2006":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Kjetil André Aamodt","country":"Norway","medals":{"gold":3,"silver":0,"bronze":0,"total":3},"medals_by_year":{"2002":{"gold":2,"silver":0,"bronze":0,"total":2},"2006":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Benjamin Raich","country":"Austria","medals":{"gold":2,"silver":0,"bronze":2,"total":4},"medals_by_year":{"2002":{"gold":0,"silver":0,"bronze":2,"total":2},"2006":{"gold":2,"silver":0,"bronze":0,"total":2}}}]

View file

@ -0,0 +1 @@
{"sport": "Volleyball", "limit": 8}

View file

@ -0,0 +1 @@
[{"athlete":"Fabi","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Fabiana","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Paula","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Pereira de Carvalho Endres Jaque","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Sheilla","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Thaísa","country":"Brazil","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Dante","country":"Brazil","medals":{"gold":1,"silver":2,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Giba","country":"Brazil","medals":{"gold":1,"silver":2,"bronze":0,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Table Tennis", "limit": 8}

View file

@ -0,0 +1 @@
{"sport": "Diving", "limit": 8}

View file

@ -0,0 +1 @@
[{"athlete":"Guo Jingjing","country":"China","medals":{"gold":4,"silver":2,"bronze":0,"total":6},"medals_by_year":{"2000":{"gold":0,"silver":2,"bronze":0,"total":2},"2004":{"gold":2,"silver":0,"bronze":0,"total":2},"2008":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Wu Minxia","country":"China","medals":{"gold":4,"silver":1,"bronze":1,"total":6},"medals_by_year":{"2004":{"gold":1,"silver":1,"bronze":0,"total":2},"2008":{"gold":1,"silver":0,"bronze":1,"total":2},"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Chen Ruolin","country":"China","medals":{"gold":4,"silver":0,"bronze":0,"total":4},"medals_by_year":{"2008":{"gold":2,"silver":0,"bronze":0,"total":2},"2012":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Qin Kai","country":"China","medals":{"gold":2,"silver":1,"bronze":1,"total":4},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":1,"total":2},"2012":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Tian Liang","country":"China","medals":{"gold":2,"silver":1,"bronze":1,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":1,"total":2}}},{"athlete":"Xiong Ni","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Yuliya Pakhalina","country":"Russia","medals":{"gold":1,"silver":3,"bronze":1,"total":5},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":0,"silver":1,"bronze":1,"total":2},"2008":{"gold":0,"silver":2,"bronze":0,"total":2}}},{"athlete":"Dmitry Sautin","country":"Russia","medals":{"gold":1,"silver":2,"bronze":3,"total":6},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":2,"total":4},"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Cross Country", "limit": 7}

View file

@ -1 +0,0 @@
sport 'Cross Country' not found

View file

@ -0,0 +1 @@
{"sport": "Badminton", "limit": 1}

View file

@ -0,0 +1 @@
[{"athlete":"Gao Ling","country":"China","medals":{"gold":2,"silver":1,"bronze":1,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":1,"total":2},"2004":{"gold":1,"silver":1,"bronze":0,"total":2}}}]

View file

@ -1 +0,0 @@
{"sport": "Weightlifting", "limit": 7}

View file

@ -1 +0,0 @@
[{"athlete":"Chen Yanqing","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Liu Chunhong","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Hossein Reza Zadeh","country":"Iran","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Ilya Ilyin","country":"Kazakhstan","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Halil Mutlu","country":"Turkey","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Jang Mi-Ran","country":"South Korea","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Zhang Xiangxiang","country":"China","medals":{"gold":1,"silver":0,"bronze":1,"total":2},"medals_by_year":{"2000":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}}]

View file

@ -0,0 +1 @@
{"sport": "Taekwondo", "limit": 10}

View file

@ -0,0 +1 @@
[{"athlete":"Hadi Saei","country":"Iran","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2000":{"gold":0,"silver":0,"bronze":1,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Hwang Gyeong-Seon","country":"South Korea","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2004":{"gold":0,"silver":0,"bronze":1,"total":1},"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Steven Lopez","country":"United States","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"Chen Zhong","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Wu Jingyu","country":"China","medals":{"gold":2,"silver":0,"bronze":0,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Chu Mu-Yen","country":"Chinese Taipei","medals":{"gold":1,"silver":0,"bronze":1,"total":2},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"María Espinoza","country":"Mexico","medals":{"gold":1,"silver":0,"bronze":1,"total":2},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"Servet Tazegül","country":"Turkey","medals":{"gold":1,"silver":0,"bronze":1,"total":2},"medals_by_year":{"2008":{"gold":0,"silver":0,"bronze":1,"total":1},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Carlo Molfetta","country":"Italy","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Chen Shih-Hsien","country":"Chinese Taipei","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Bobsleigh", "limit": 0}

View file

@ -1 +0,0 @@
null

View file

@ -0,0 +1 @@
{"sport": "Figure Skating", "limit": 5}

View file

@ -0,0 +1 @@
[{"athlete":"Yevgeny Plyushchenko","country":"Russia","medals":{"gold":1,"silver":2,"bronze":0,"total":3},"medals_by_year":{"2002":{"gold":0,"silver":1,"bronze":0,"total":1},"2006":{"gold":1,"silver":0,"bronze":0,"total":1},"2010":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Shen Xue","country":"China","medals":{"gold":1,"silver":0,"bronze":2,"total":3},"medals_by_year":{"2002":{"gold":0,"silver":0,"bronze":1,"total":1},"2006":{"gold":0,"silver":0,"bronze":1,"total":1},"2010":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Zhao Hongbo","country":"China","medals":{"gold":1,"silver":0,"bronze":2,"total":3},"medals_by_year":{"2002":{"gold":0,"silver":0,"bronze":1,"total":1},"2006":{"gold":0,"silver":0,"bronze":1,"total":1},"2010":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Aleksey Yagudin","country":"Russia","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2002":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Anton Sikharulidze","country":"Russia","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2002":{"gold":1,"silver":0,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Triathlon", "limit": 9}

View file

@ -1 +0,0 @@
[{"athlete":"Simon Whitfield","country":"Canada","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Emma Snowsill","country":"Australia","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Kate Allen","country":"Austria","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Jan Frodeno","country":"Germany","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Alistair Brownlee","country":"Great Britain","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Hamish Carter","country":"New Zealand","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Brigitte McMahon","country":"Switzerland","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Nicola Spirig","country":"Switzerland","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Bevan Docherty","country":"New Zealand","medals":{"gold":0,"silver":1,"bronze":1,"total":2},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":0,"silver":0,"bronze":1,"total":1}}}]

View file

@ -0,0 +1 @@
{"sport": "Triathlon", "limit": 11}

View file

@ -0,0 +1 @@
[{"athlete":"Simon Whitfield","country":"Canada","medals":{"gold":1,"silver":1,"bronze":0,"total":2},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Alistair Brownlee","country":"Great Britain","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Brigitte McMahon","country":"Switzerland","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Emma Snowsill","country":"Australia","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Hamish Carter","country":"New Zealand","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Jan Frodeno","country":"Germany","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2008":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Kate Allen","country":"Austria","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Nicola Spirig","country":"Switzerland","medals":{"gold":1,"silver":0,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Bevan Docherty","country":"New Zealand","medals":{"gold":0,"silver":1,"bronze":1,"total":2},"medals_by_year":{"2004":{"gold":0,"silver":1,"bronze":0,"total":1},"2008":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"Javier Gómez","country":"Spain","medals":{"gold":0,"silver":1,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Lisa Nordén","country":"Sweden","medals":{"gold":0,"silver":1,"bronze":0,"total":1},"medals_by_year":{"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Equestrian", "limit": 4}

View file

@ -1 +0,0 @@
[{"athlete":"Anky van Grunsven","country":"Netherlands","medals":{"gold":3,"silver":2,"bronze":1,"total":6},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":1,"bronze":0,"total":2},"2012":{"gold":0,"silver":0,"bronze":1,"total":1}}},{"athlete":"Isabell Werth","country":"Germany","medals":{"gold":2,"silver":2,"bronze":0,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2},"2008":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Ulla Salzgeber","country":"Germany","medals":{"gold":2,"silver":1,"bronze":1,"total":4},"medals_by_year":{"2000":{"gold":1,"silver":0,"bronze":1,"total":2},"2004":{"gold":1,"silver":1,"bronze":0,"total":2}}},{"athlete":"Heike Kemmer","country":"Germany","medals":{"gold":2,"silver":0,"bronze":1,"total":3},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2008":{"gold":1,"silver":0,"bronze":1,"total":2}}}]

View file

@ -0,0 +1 @@
{"sport": "Swimming", "limit": 15}

View file

@ -0,0 +1 @@
[{"athlete":"Michael Phelps","country":"United States","medals":{"gold":18,"silver":2,"bronze":2,"total":22},"medals_by_year":{"2004":{"gold":6,"silver":0,"bronze":2,"total":8},"2008":{"gold":8,"silver":0,"bronze":0,"total":8},"2012":{"gold":4,"silver":2,"bronze":0,"total":6}}},{"athlete":"Ryan Lochte","country":"United States","medals":{"gold":5,"silver":3,"bronze":3,"total":11},"medals_by_year":{"2004":{"gold":1,"silver":1,"bronze":0,"total":2},"2008":{"gold":2,"silver":0,"bronze":2,"total":4},"2012":{"gold":2,"silver":2,"bronze":1,"total":5}}},{"athlete":"Ian Thorpe","country":"Australia","medals":{"gold":5,"silver":3,"bronze":1,"total":9},"medals_by_year":{"2000":{"gold":3,"silver":2,"bronze":0,"total":5},"2004":{"gold":2,"silver":1,"bronze":1,"total":4}}},{"athlete":"Aaron Peirsol","country":"United States","medals":{"gold":5,"silver":2,"bronze":0,"total":7},"medals_by_year":{"2000":{"gold":0,"silver":1,"bronze":0,"total":1},"2004":{"gold":3,"silver":0,"bronze":0,"total":3},"2008":{"gold":2,"silver":1,"bronze":0,"total":3}}},{"athlete":"Inge de Bruijn","country":"Netherlands","medals":{"gold":4,"silver":2,"bronze":2,"total":8},"medals_by_year":{"2000":{"gold":3,"silver":1,"bronze":0,"total":4},"2004":{"gold":1,"silver":1,"bronze":2,"total":4}}},{"athlete":"Jason Lezak","country":"United States","medals":{"gold":4,"silver":2,"bronze":2,"total":8},"medals_by_year":{"2000":{"gold":1,"silver":1,"bronze":0,"total":2},"2004":{"gold":1,"silver":0,"bronze":1,"total":2},"2008":{"gold":2,"silver":0,"bronze":1,"total":3},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Matt Grevers","country":"United States","medals":{"gold":4,"silver":2,"bronze":0,"total":6},"medals_by_year":{"2008":{"gold":2,"silver":1,"bronze":0,"total":3},"2012":{"gold":2,"silver":1,"bronze":0,"total":3}}},{"athlete":"Kosuke Kitajima","country":"Japan","medals":{"gold":4,"silver":1,"bronze":2,"total":7},"medals_by_year":{"2004":{"gold":2,"silver":0,"bronze":1,"total":3},"2008":{"gold":2,"silver":0,"bronze":1,"total":3},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Libby Lenton-Trickett","country":"Australia","medals":{"gold":4,"silver":1,"bronze":2,"total":7},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":1,"total":2},"2008":{"gold":2,"silver":1,"bronze":1,"total":4},"2012":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Yana Klochkova","country":"Ukraine","medals":{"gold":4,"silver":1,"bronze":0,"total":5},"medals_by_year":{"2000":{"gold":2,"silver":1,"bronze":0,"total":3},"2004":{"gold":2,"silver":0,"bronze":0,"total":2}}},{"athlete":"Missy Franklin","country":"United States","medals":{"gold":4,"silver":0,"bronze":1,"total":5},"medals_by_year":{"2012":{"gold":4,"silver":0,"bronze":1,"total":5}}},{"athlete":"Dana Vollmer","country":"United States","medals":{"gold":4,"silver":0,"bronze":0,"total":4},"medals_by_year":{"2004":{"gold":1,"silver":0,"bronze":0,"total":1},"2012":{"gold":3,"silver":0,"bronze":0,"total":3}}},{"athlete":"Lenny Krayzelburg","country":"United States","medals":{"gold":4,"silver":0,"bronze":0,"total":4},"medals_by_year":{"2000":{"gold":3,"silver":0,"bronze":0,"total":3},"2004":{"gold":1,"silver":0,"bronze":0,"total":1}}},{"athlete":"Leisel Jones","country":"Australia","medals":{"gold":3,"silver":5,"bronze":1,"total":9},"medals_by_year":{"2000":{"gold":0,"silver":2,"bronze":0,"total":2},"2004":{"gold":1,"silver":1,"bronze":1,"total":3},"2008":{"gold":2,"silver":1,"bronze":0,"total":3},"2012":{"gold":0,"silver":1,"bronze":0,"total":1}}},{"athlete":"Natalie Coughlin","country":"United States","medals":{"gold":3,"silver":4,"bronze":5,"total":12},"medals_by_year":{"2004":{"gold":2,"silver":2,"bronze":1,"total":5},"2008":{"gold":1,"silver":2,"bronze":3,"total":6},"2012":{"gold":0,"silver":0,"bronze":1,"total":1}}}]

View file

@ -1 +0,0 @@
{"sport": "Boxing", "limit": 10}

Some files were not shown because too many files have changed in this diff Show more