| Index: recipe_engine/unittests/run_test.py
|
| diff --git a/recipe_engine/unittests/run_test.py b/recipe_engine/unittests/run_test.py
|
| index cec960f0e21b6ef47afe03f3a6136e132db05ceb..00e1a0106b699744b92a3f86a7a6aff2e37c5498 100755
|
| --- a/recipe_engine/unittests/run_test.py
|
| +++ b/recipe_engine/unittests/run_test.py
|
| @@ -16,6 +16,8 @@ from test_env import BASE_DIR
|
|
|
| import recipe_engine.run
|
| import recipe_engine.step_runner
|
| +from recipe_engine import arguments_pb2
|
| +from google.protobuf import json_format as jsonpb
|
| from recipe_engine import requests_ssl
|
|
|
| class RunTest(unittest.TestCase):
|
| @@ -200,6 +202,64 @@ class RunTest(unittest.TestCase):
|
| r'(?m)^@@@STEP_CURSOR@Subannotate me@@@\n@@@STEP_CLOSED@@@$')
|
|
|
|
|
| +class TestOperationalArgs(unittest.TestCase):
|
| + def test_operational_arg_parsing(self):
|
| + # For convenience, we'll define the JSONPB data as a Python dict that we
|
| + # will then dump into JSON.
|
| + op_args = jsonpb.Parse(json.dumps({
|
| + 'properties': {'property': {
|
| + 'a': {'s': 'Hello'},
|
| + 'b': {'int': -12345},
|
| + 'c': {'uint': 12345},
|
| + 'd': {'d': 3.14159},
|
| + 'e': {'b': True},
|
| + 'f': {'data': '\x60\x0d\xd0\x65'.encode('base64')},
|
| + 'g': {'map': {
|
| + 'property': {
|
| + 'foo': {'s': 'FOO!'},
|
| + 'bar': {'map': {
|
| + 'property': {
|
| + 'baz': {'s': 'BAZ!'},
|
| + },
|
| + }},
|
| + }},
|
| + },
|
| + 'h': {'list': {
|
| + 'property': [
|
| + {'s': 'foo'},
|
| + {'s': 'bar'},
|
| + {'s': 'baz'},
|
| + ],
|
| + }},
|
| + }},
|
| + 'annotationFlags': {
|
| + 'emitTimestamp': True,
|
| + },
|
| + }), arguments_pb2.Arguments())
|
| +
|
| + self.assertEqual(
|
| + recipe_engine.run._op_properties_to_dict(op_args.properties.property),
|
| + {
|
| + u'a': u'Hello',
|
| + u'b': -12345L,
|
| + u'c': 12345L,
|
| + u'd': 3.14159,
|
| + u'e': True,
|
| + u'f': '\x60\x0d\xd0\x65',
|
| + u'g': {
|
| + u'foo': u'FOO!',
|
| + u'bar': {
|
| + u'baz': u'BAZ!',
|
| + },
|
| + },
|
| + u'h': [
|
| + u'foo',
|
| + u'bar',
|
| + u'baz',
|
| + ],
|
| + })
|
| +
|
| +
|
| if __name__ == '__main__':
|
| unittest.TestCase.maxDiff = None
|
| unittest.main()
|
|
|