Fix --rev option for pure protobuf support
Change-Id: Ib66604c30159a73f96f529eea40fea329627132f
diff --git a/lib/xos-genx/tests/pure_proto_test.py b/lib/xos-genx/tests/pure_proto_test.py
index b7330d0..836b0b0 100644
--- a/lib/xos-genx/tests/pure_proto_test.py
+++ b/lib/xos-genx/tests/pure_proto_test.py
@@ -5,8 +5,7 @@
# Generate from xproto, then generate from equivalent proto
class XPureProtobufGenerator(unittest.TestCase):
- #FIXME this test is failinf
- def _test_pure_proto(self):
+ def test_pure_proto(self):
xproto = \
"""
message VRouterPort (XOSBase){
diff --git a/lib/xos-genx/tests/test_generator.py b/lib/xos-genx/tests/test_generator.py
index a13fb38..d44eec1 100644
--- a/lib/xos-genx/tests/test_generator.py
+++ b/lib/xos-genx/tests/test_generator.py
@@ -34,7 +34,7 @@
if not f.startswith('.'):
os.remove(OUTPUT_DIR + '/' + f)
- def _test_generator_custom_target_from_file(self):
+ def test_generator_custom_target_from_file(self):
"""
[XOS-GenX] Generate output from base.xproto
"""
@@ -44,7 +44,7 @@
output = XOSGenerator.generate(args)
self.assertEqual(output, TEST_EXPECTED_OUTPUT)
- def _test_generator_custom_target_from_inputs(self):
+ def test_generator_custom_target_from_inputs(self):
"""
[XOS-GenX] Generate output from base.xproto
"""
@@ -54,26 +54,7 @@
output = XOSGenerator.generate(args)
self.assertEqual(output, TEST_EXPECTED_OUTPUT)
- def _test_generator_tosca(self):
- """
- [XOS-GenX] Generate TOSCA from base.xproto, and write to file
- """
- args = FakeArgs()
- args.files = [TEST_XPROTO, VROUTER_XPROTO]
- args.target = 'tosca.xtarget'
- args.output = OUTPUT_DIR
- args.write_to_file = 'single'
- args.dest_file = 'base.yaml'
- XOSGenerator.generate(args)
-
- dest_file = OUTPUT_DIR + '/' + args.dest_file
- self.assertTrue(os.path.isfile(dest_file))
-
- output = open(dest_file, "r").read()
- self.assertIn("tosca.nodes.XOSModel", output)
- self.assertIn("tosca.nodes.VRouterPort", output)
-
- def _test_django_with_attic(self):
+ def test_django_with_attic(self):
"""
[XOS-GenX] Generate django output from test.xproto
"""
@@ -107,7 +88,7 @@
self.assertIn('header import *', vrpf)
self.assertIn('class VRouterPort(XOSBase):', vrpf)
- def _test_django_with_base(self):
+ def test_django_with_base(self):
args = FakeArgs()
args.files = [TEST_XPROTO, BASE_XPROTO]
args.target = 'django.xtarget'
@@ -130,7 +111,7 @@
self.assertIn('header import *', xbf)
self.assertIn('class XOSBase(models.Model, PlModelMixIn):', xbf)
- def _test_write_multiple_files(self):
+ def test_write_multiple_files(self):
"""
[XOS-GenX] read multiple models as input, print one file per model
"""
@@ -171,7 +152,7 @@
self.assertIn("name: XOSModel", xosmodel)
self.assertIn("name: VRouterPort", vrouterport)
- def _test_skip_django(self):
+ def test_skip_django(self):
args = FakeArgs()
args.files = [SKIP_DJANGO_XPROTO]
args.target = 'django.xtarget'
@@ -209,4 +190,4 @@
if __name__ == '__main__':
- unittest.main()
\ No newline at end of file
+ unittest.main()
diff --git a/lib/xos-genx/xosgenx/generator.py b/lib/xos-genx/xosgenx/generator.py
index 239a42a..668d351 100755
--- a/lib/xos-genx/xosgenx/generator.py
+++ b/lib/xos-genx/xosgenx/generator.py
@@ -24,9 +24,9 @@
if hasattr(args, 'rev') and args.rev:
v = Proto2XProto()
ast.accept(v)
- else:
- v = XOS2Jinja()
- ast.accept(v)
+
+ v = XOS2Jinja()
+ ast.accept(v)
return v
@staticmethod
@@ -220,4 +220,4 @@
elif args.output is not None and args.write_to_file == "single":
XOSGenerator._write_single_file(rendered, args.output, args.dest_file, args.quiet)
- return rendered
\ No newline at end of file
+ return rendered