-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_example_plugin.py
executable file
·44 lines (34 loc) · 1.22 KB
/
test_example_plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
import unittest
import example_plugin
from arcaflow_plugin_sdk import plugin
class ExamplePluginTest(unittest.TestCase):
@staticmethod
def test_serialization():
plugin.test_object_serialization(
example_plugin.InputParams(
name=example_plugin.FullName("Arca", "Lot")
)
)
plugin.test_object_serialization(
example_plugin.SuccessOutput(message="Hello, Arca Lot!")
)
plugin.test_object_serialization(
example_plugin.ErrorOutput(error="This is an error")
)
def test_functional(self):
step_input = example_plugin.InputParams(
name=example_plugin.FullName("Arca", "Lot")
)
# Note: The call to hello_world is to the output of the decorator, not
# the function itself, so it's calling the StepType
output_id, output_data = example_plugin.hello_world(
self.id(), step_input
)
# The example plugin always returns an error:
self.assertEqual("success", output_id)
self.assertEqual(
output_data, example_plugin.SuccessOutput("Hello, Arca Lot!")
)
if __name__ == "__main__":
unittest.main()