Commit 2b2d84e8 authored by André Anjos's avatar André Anjos 💬

Merge branch '64_add_protocoltemplate_prototype' into 'master'

Implement support for protocol template prototype

See merge request !71
parents 1a1a8c49 6735c859
Pipeline #29849 passed with stages
in 18 minutes and 44 seconds
......@@ -48,6 +48,7 @@ Forward importing from :py:mod:`beat.backend.python.protocoltemplate`:
import six
from . import schema
from . import prototypes
from beat.backend.python.protocoltemplate import Storage
from beat.backend.python.protocoltemplate import (
......@@ -106,6 +107,10 @@ class ProtocolTemplate(BackendProtocolTemplate):
self.storage = None
self.dataformats = {} # preloaded dataformats
if data is None: # loads prototype and validates it
self.data, self.errors = prototypes.load("protocoltemplate")
assert not self.errors, "\n * %s" % "\n *".join(self.errors) # nosec
else:
if isinstance(data, six.string_types): # user has passed a file pointer
self._name = data
......
{
"schema_version": 1,
"sets": [
{
"name": "name",
"outputs": {
"out": "user/single_integer/1"
}
}
]
}
......@@ -41,6 +41,12 @@ from . import prefix, tmp_prefix
from .utils import cleanup
def test_default():
obj = ProtocolTemplate(prefix, data=None)
nose.tools.assert_true(obj.valid, "\n * %s" % "\n * ".join(obj.errors))
def test_export():
for protocol_name in [
"double",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment