scouting: Add support for /requests/request/matches_for_team
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I00bf80f2a8ee45db896adf025290e4dad4ba4273
diff --git a/scouting/webserver/requests/debug/cli/cli_test.py b/scouting/webserver/requests/debug/cli/cli_test.py
index 8020c64..6b47ae9 100644
--- a/scouting/webserver/requests/debug/cli/cli_test.py
+++ b/scouting/webserver/requests/debug/cli/cli_test.py
@@ -78,5 +78,15 @@
self.assertEqual(exit_code, 0)
self.assertIn("{MatchList:[]}", stderr)
+ def test_request_matches_for_team(self):
+ json_path = write_json({
+ "team": 971,
+ })
+ exit_code, _stdout, stderr = run_debug_cli(["-requestMatchesForTeam", json_path])
+
+ # TODO(phil): Actually add some matches here.
+ self.assertEqual(exit_code, 0)
+ self.assertIn("{MatchList:[]}", stderr)
+
if __name__ == "__main__":
unittest.main()
diff --git a/scouting/webserver/requests/debug/cli/main.go b/scouting/webserver/requests/debug/cli/main.go
index 204e541..44ae761 100644
--- a/scouting/webserver/requests/debug/cli/main.go
+++ b/scouting/webserver/requests/debug/cli/main.go
@@ -72,6 +72,8 @@
"If specified, parse the file as a SubmitDataScouting JSON request.")
requestAllMatchesPtr := flag.String("requestAllMatches", "",
"If specified, parse the file as a RequestAllMatches JSON request.")
+ requestMatchesForTeamPtr := flag.String("requestMatchesForTeam", "",
+ "If specified, parse the file as a RequestMatchesForTeam JSON request.")
flag.Parse()
// Handle the actual arguments.
@@ -97,4 +99,15 @@
}
log.Printf("%+v", *response)
}
+ if *requestMatchesForTeamPtr != "" {
+ log.Printf("Sending RequestMatchesForTeam to %s", *addressPtr)
+ binaryRequest := parseJson(
+ "scouting/webserver/requests/messages/request_matches_for_team.fbs",
+ *requestMatchesForTeamPtr)
+ response, err := debug.RequestMatchesForTeam(*addressPtr, binaryRequest)
+ if err != nil {
+ log.Fatal("Failed RequestMatchesForTeam: ", err)
+ }
+ log.Printf("%+v", *response)
+ }
}