Skip to content

Commit

Permalink
Merge 54af66e into 1d5ce00
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed May 28, 2019
2 parents 1d5ce00 + 54af66e commit 5dce427
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
6 changes: 6 additions & 0 deletions temba_client/v2/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ def test_get_flows(self, mock_request):
self.assertEqual(results[0].runs.completed, 123)
self.assertEqual(results[0].runs.interrupted, 2)
self.assertEqual(results[0].runs.expired, 34)
self.assertEqual(results[0].results[0].key, "color")
self.assertEqual(results[0].results[0].name, "Color")
self.assertEqual(results[0].results[0].categories, ["Orange", "Blue", "Other", "Nothing"])
self.assertEqual(
results[0].results[0].node_uuids,
["2bfbd76a-245a-473c-a296-28e4815f3a98", "d8b0ed18-a5c2-48be-98af-9b7f017fdc6c"])

# check with all params
self.client.get_flows(uuid="ffce0fbb-4fe1-4052-b26a-91beb2ebae9a").all()
Expand Down
7 changes: 7 additions & 0 deletions temba_client/v2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,20 @@ class Runs(TembaObject):
interrupted = IntegerField()
expired = IntegerField()

class FlowResult(TembaObject):
key = SimpleField()
name = SimpleField()
categories = SimpleField()
node_uuids = SimpleField()

uuid = SimpleField()
name = SimpleField()
archived = BooleanField()
labels = ObjectListField(item_class=ObjectRef)
expires = IntegerField()
created_on = DatetimeField()
runs = ObjectField(item_class=Runs)
results = ObjectListField(item_class=FlowResult)


class FlowStart(TembaObject):
Expand Down
21 changes: 19 additions & 2 deletions test_files/v2/flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
"completed": 123,
"interrupted": 2,
"expired": 34
}
},
"results": [
{
"key": "color",
"name": "Color",
"categories": ["Orange", "Blue", "Other", "Nothing"],
"node_uuids": ["2bfbd76a-245a-473c-a296-28e4815f3a98", "d8b0ed18-a5c2-48be-98af-9b7f017fdc6c"]
}
]

},
{
"uuid": "1b1add1b-6ed4-4e13-9b08-9127b2d33c74",
Expand All @@ -28,7 +37,15 @@
"completed": 0,
"interrupted": 0,
"expired": 0
}
},
"results": [
{
"key": "color",
"name": "Color",
"categories": ["Orange", "Blue", "Other", "Nothing"],
"node_uuids": ["1c57c86c-14a7-4e32-b8a7-07a5c690e9e0", "8dfc0cca-6812-4ad1-a390-39e6923be5a1"]
}
]
}
]
}

0 comments on commit 5dce427

Please sign in to comment.