Combine scouting webserver and scouting web pages

This patch adds a new `//scouting` target that runs the webserver and
points it at our web pages. This will be the target that folks can use
to run the entire scouting application.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I62acfb271b856f9d238b17ecc3573f31a07bab41
diff --git a/scouting/scouting_test.py b/scouting/scouting_test.py
new file mode 100644
index 0000000..3b62224
--- /dev/null
+++ b/scouting/scouting_test.py
@@ -0,0 +1,38 @@
+# TODO(phil): Delete this and replace it with a selenium test. Preferably
+# written in either Javascript or Go.
+
+import socket
+import subprocess
+import time
+import unittest
+import urllib.request
+
+class TestDebugCli(unittest.TestCase):
+
+    def setUp(self):
+        self.webserver = subprocess.Popen(["scouting/scouting"])
+
+        # Wait for the server to respond to requests.
+        while True:
+            try:
+                connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+                connection.connect(("localhost", 8080))
+                connection.close()
+                break
+            except ConnectionRefusedError:
+                connection.close()
+                time.sleep(0.01)
+
+    def tearDown(self):
+        self.webserver.terminate()
+        self.webserver.wait()
+
+    def test_index_html(self):
+        """Makes sure that we the scouting server is serving our main index.html file."""
+        with urllib.request.urlopen("http://localhost:8080/") as file:
+            html = file.read().decode("utf-8")
+        self.assertIn("<my-app></my-app>", html)
+
+
+if __name__ == "__main__":
+    unittest.main()