scouting: Add an endpoint for populating the match schedule

This patch combines the scraping library with the scouting webserver.
There's now also a new end point for the web page (or debug CLI tool)
to ask the server to fetch the match list. The end point is
`/requests/refresh_match_list`.

All the tests are updated. The `cli_test` downloads a 2016 ny_tr match
list that I downloaded from TBA. It should be a decent integration
test as it uses representative data.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I6c540590521b00887eb2ddde2a9369875c659551
diff --git a/scouting/webserver/requests/debug/cli/main.go b/scouting/webserver/requests/debug/cli/main.go
index 0782d82..03032be 100644
--- a/scouting/webserver/requests/debug/cli/main.go
+++ b/scouting/webserver/requests/debug/cli/main.go
@@ -11,6 +11,7 @@
 	"os/exec"
 	"path/filepath"
 
+	"github.com/davecgh/go-spew/spew"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/requests/debug"
 )
 
@@ -76,6 +77,8 @@
 		"If specified, parse the file as a RequestMatchesForTeam JSON request.")
 	requestDataScoutingPtr := flag.String("requestDataScouting", "",
 		"If specified, parse the file as a RequestDataScouting JSON request.")
+	refreshMatchListPtr := flag.String("refreshMatchList", "",
+		"If specified, parse the file as a RefreshMatchList JSON request.")
 	flag.Parse()
 
 	// Handle the actual arguments.
@@ -88,7 +91,7 @@
 		if err != nil {
 			log.Fatal("Failed SubmitDataScouting: ", err)
 		}
-		log.Printf("%+v", *response)
+		spew.Dump(*response)
 	}
 	if *requestAllMatchesPtr != "" {
 		log.Printf("Sending RequestAllMatches to %s", *addressPtr)
@@ -99,7 +102,7 @@
 		if err != nil {
 			log.Fatal("Failed RequestAllMatches: ", err)
 		}
-		log.Printf("%+v", *response)
+		spew.Dump(*response)
 	}
 	if *requestMatchesForTeamPtr != "" {
 		log.Printf("Sending RequestMatchesForTeam to %s", *addressPtr)
@@ -110,7 +113,7 @@
 		if err != nil {
 			log.Fatal("Failed RequestMatchesForTeam: ", err)
 		}
-		log.Printf("%+v", *response)
+		spew.Dump(*response)
 	}
 	if *requestDataScoutingPtr != "" {
 		log.Printf("Sending RequestDataScouting to %s", *addressPtr)
@@ -121,6 +124,17 @@
 		if err != nil {
 			log.Fatal("Failed RequestDataScouting: ", err)
 		}
-		log.Printf("%+v", *response)
+		spew.Dump(*response)
+	}
+	if *refreshMatchListPtr != "" {
+		log.Printf("Sending RefreshMatchList to %s", *addressPtr)
+		binaryRequest := parseJson(
+			"scouting/webserver/requests/messages/refresh_match_list.fbs",
+			*refreshMatchListPtr)
+		response, err := debug.RefreshMatchList(*addressPtr, binaryRequest)
+		if err != nil {
+			log.Fatal("Failed RefreshMatchList: ", err)
+		}
+		spew.Dump(*response)
 	}
 }