Fixed tests
This commit is contained in:
parent
bfa86694ce
commit
2487078c8e
|
@ -16,4 +16,7 @@ class Action:
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def execute(self, workspace, **kwargs):
|
def execute(self, workspace, **kwargs):
|
||||||
|
"""
|
||||||
|
Main method to override that handles the work for the defining action.
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import factory
|
import factory
|
||||||
|
|
||||||
from jeeves.core.objects import Flow, Task
|
from jeeves.core.objects import Flow, Task
|
||||||
from jeeves.core.registry import ActionRegistry
|
|
||||||
|
|
||||||
|
|
||||||
class TaskFactory(factory.Factory):
|
class TaskFactory(factory.Factory):
|
||||||
name = factory.Faker("name")
|
name = factory.Faker("name")
|
||||||
type = factory.Iterator(ActionRegistry.actions)
|
type = "jeeves.core.actions.stub:StubSuccessAction"
|
||||||
parameters = {"script": "#!/bin/bash\necho test"}
|
parameters = {}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Task
|
model = Task
|
||||||
|
|
|
@ -24,7 +24,7 @@ EXPORTED_FLOW = {
|
||||||
def test_parser_object_to_dict_ok():
|
def test_parser_object_to_dict_ok():
|
||||||
obj: Flow = FlowFactory()
|
obj: Flow = FlowFactory()
|
||||||
result = FlowParser.to_dict(obj)
|
result = FlowParser.to_dict(obj)
|
||||||
assert set(obj.fields).issubset(set(result))
|
assert set(obj.dict()).issuperset(set(result))
|
||||||
|
|
||||||
|
|
||||||
def test_parser_dict_to_object_ok():
|
def test_parser_dict_to_object_ok():
|
||||||
|
@ -53,7 +53,7 @@ def test_parser_json_file_to_object_ok():
|
||||||
def test_parser_obj_to_json_ok():
|
def test_parser_obj_to_json_ok():
|
||||||
obj: Flow = FlowFactory()
|
obj: Flow = FlowFactory()
|
||||||
result = FlowParser.to_json(obj)
|
result = FlowParser.to_json(obj)
|
||||||
assert set(obj.fields).issubset(set(json.loads(result)))
|
assert set(obj.dict()).issuperset(set(json.loads(result)))
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
|
@ -77,4 +77,4 @@ def test_parser_toml_file_to_object_ok():
|
||||||
def test_parser_obj_to_toml_ok():
|
def test_parser_obj_to_toml_ok():
|
||||||
obj: Flow = FlowFactory()
|
obj: Flow = FlowFactory()
|
||||||
result = FlowParser.to_toml(obj)
|
result = FlowParser.to_toml(obj)
|
||||||
assert set(obj.fields).issubset(set(toml.loads(result)))
|
assert set(obj.dict()).issuperset(set(toml.loads(result)))
|
||||||
|
|
Reference in New Issue