Build API config: Use a proto-based configuration
Switch the Build API to use a proto configuration rather than
CLI options. This provides cleaner backwards compatibility for
the build api itself.
BUG=chromium:1040978
TEST=run_tests
Change-Id: I515271b4244c354c38538b30dcc1cfa07517f821
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1994725
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Will Bradley <wbbradley@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/api/api_config_unittest.py b/api/api_config_unittest.py
index a616af9..ebbf925 100644
--- a/api/api_config_unittest.py
+++ b/api/api_config_unittest.py
@@ -14,30 +14,17 @@
class ApiConfigTest(cros_test_lib.TestCase):
"""ApiConfig tests."""
- def test_incompatible_arguments(self):
- """Test incompatible argument checks."""
- # Can only specify True for one of validate_only, mock_call, and mock_error.
- # Enumerating them was unnecessary, but it's only 4 cases.
- with self.assertRaises(AssertionError):
- ApiConfig(validate_only=True, mock_call=True)
- with self.assertRaises(AssertionError):
- ApiConfig(validate_only=True, mock_error=True)
- with self.assertRaises(AssertionError):
- ApiConfig(mock_call=True, mock_error=True)
- with self.assertRaises(AssertionError):
- ApiConfig(validate_only=True, mock_call=True, mock_error=True)
-
def test_do_validation(self):
"""Sanity check for the do validation property being True."""
# Should validate by default, and when only doing validation.
config = ApiConfig()
self.assertTrue(config.do_validation)
- config = ApiConfig(validate_only=True)
+ config = ApiConfig(call_type=ApiConfig.CALL_TYPE_VALIDATE_ONLY)
self.assertTrue(config.do_validation)
def test_no_do_validation(self):
"""Sanity check for skipping validation for mock calls."""
- config = ApiConfig(mock_call=True)
+ config = ApiConfig(call_type=ApiConfig.CALL_TYPE_MOCK_SUCCESS)
self.assertFalse(config.do_validation)
- config = ApiConfig(mock_error=True)
+ config = ApiConfig(call_type=ApiConfig.CALL_TYPE_MOCK_FAILURE)
self.assertFalse(config.do_validation)