Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2573)

Unified Diff: appengine/config_service/services_test.py

Issue 1221643020: config services: services.cfg and validation (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/config_service/services_test.py
diff --git a/appengine/config_service/services_test.py b/appengine/config_service/services_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..6504a076cc47c5377fc6e55bf8c228b022eb0c81
--- /dev/null
+++ b/appengine/config_service/services_test.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# Copyright 2015 The Swarming Authors. All rights reserved.
+# Use of this source code is governed by the Apache v2.0 license that can be
+# found in the LICENSE file.
+
+from test_env import future
+import test_env
+test_env.setup_test_env()
+
+import mock
+from test_support import test_case
+
+from proto import service_config_pb2
+import services
+import storage
+
+
+class ProjectsTestCase(test_case.TestCase):
+ def test_dict_to_dynamic_metadata(self):
+ with self.assertRaises(services.DynamicMetadataError):
+ services._dict_to_dynamic_metadata([])
+
+ self.assertEqual(
+ services._dict_to_dynamic_metadata({
+ 'validation': {
+ 'url': 'https://a.com/validate',
+ 'patterns': [
+ {'config_set': 'projects/foo', 'path': 'bar.cfg'},
+ {'config_set': 'regex:services/.+', 'path': 'regex:.+'},
+ ]
+ }
+ }),
+ service_config_pb2.ServiceDynamicMetadata(
+ validation=service_config_pb2.Validator(
+ url='https://a.com/validate',
+ patterns=[
+ service_config_pb2.ConfigPattern(
+ config_set='projects/foo', path='bar.cfg'),
+ service_config_pb2.ConfigPattern(
+ config_set='regex:services/.+', path='regex:.+'),
+ ]
+ )
+ )
+ )
+
+
+if __name__ == '__main__':
+ test_env.main()

Powered by Google App Engine
This is Rietveld 408576698