Fixes FactService

This commit is contained in:
Aaron Louie 2020-02-11 22:13:46 -05:00
parent a69c709bd1
commit 5f461d9e87
2 changed files with 9 additions and 6 deletions

View File

@ -17,14 +17,14 @@ class FactService:
return response.json()['value'] return response.json()['value']
def do_task(self, task, **kwargs): def do_task(self, task, **kwargs):
if "Fact.type" not in task.data: print(task.data)
if "type" not in task.data:
raise Exception("No Fact Provided.") raise Exception("No Fact Provided.")
else: else:
fact = task.data["Fact.type"] fact = task.data["type"]
if True: if fact == "cat":
details = "Assertively Incubate Seamless Niches"
elif fact == "cat":
details = self.get_cat() details = self.get_cat()
elif fact == "norris": elif fact == "norris":
details = self.get_norris() details = self.get_norris()
@ -32,4 +32,7 @@ class FactService:
details = self.get_buzzword() details = self.get_buzzword()
else: else:
details = "unknown fact type." details = "unknown fact type."
task.data['details'] = details task.data['details'] = details
print(details)
return details

View File

@ -38,7 +38,7 @@ class TestWorkflowProcessor(BaseTest):
self.assertEqual(1, len(next_user_tasks)) self.assertEqual(1, len(next_user_tasks))
task = next_user_tasks[0] task = next_user_tasks[0]
self.assertEqual("Task_User_Select_Type", task.get_name()) self.assertEqual("Task_User_Select_Type", task.get_name())
model = {"Fact.type": "buzzword"} model = {"type": "buzzword"}
if task.data is None: if task.data is None:
task.data = {} task.data = {}
task.data.update(model) task.data.update(model)