Expose the median_bitrate in the list view

This commit is contained in:
Arturo Filastò 2018-09-11 18:41:15 +02:00
commit 2081c25b73
4 changed files with 48 additions and 16 deletions

View file

@ -2,6 +2,7 @@ package database
import (
"database/sql"
"encoding/json"
"io/ioutil"
"os"
"testing"
@ -145,3 +146,22 @@ func TestURLCreation(t *testing.T) {
t.Error("inserting the same URL with different category code should produce the same result")
}
}
func TestPerformanceTestKeys(t *testing.T) {
var tk PerformanceTestKeys
ndtS := "{\"download\":100.0,\"upload\":20.0,\"ping\":2.2}"
dashS := "{\"median_bitrate\":102.0}"
if err := json.Unmarshal([]byte(ndtS), &tk); err != nil {
t.Fatal("failed to parse ndtS")
}
if err := json.Unmarshal([]byte(dashS), &tk); err != nil {
t.Fatal("failed to parse dashS")
}
if tk.Bitrate != 102.0 {
t.Fatalf("error Bitrate %f", tk.Bitrate)
}
if tk.Download != 100.0 {
t.Fatalf("error Download %f", tk.Download)
}
}