api/router.py: Cleanup unused methods, add tests.

BUG=None
TEST=run_tests

Change-Id: I387df293b33eb334d6248e5e8b8849baa82af0a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1776346
Tested-by: Alex Klein <saklein@chromium.org>
Auto-Submit: Alex Klein <saklein@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/router_unittest.py b/api/router_unittest.py
index 95a2ae0..742ed69 100644
--- a/api/router_unittest.py
+++ b/api/router_unittest.py
@@ -211,3 +211,21 @@
     self.assertCommandContains(['build_api', service_method], enter_chroot=True)
     # It should be writing the empty message out.
     self.assertFileContents(self.output_file, '{}')
+
+  def testInvalidService(self):
+    """Test invalid service call."""
+    service = 'chromite.api.DoesNotExist'
+    method = 'OutsideServiceInsideMethod'
+
+    with self.assertRaises(router.UnknownServiceError):
+      self.router.Route(service, method, self.input_file, self.output_file,
+                        self.api_config)
+
+  def testInvalidMethod(self):
+    """Test invalid method call."""
+    service = 'chromite.api.OutsideChrootApiService'
+    method = 'DoesNotExist'
+
+    with self.assertRaises(router.UnknownMethodError):
+      self.router.Route(service, method, self.input_file, self.output_file,
+                        self.api_config)