-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_stage.py
57 lines (47 loc) · 1.84 KB
/
test_stage.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
45
46
47
48
49
50
51
52
53
54
55
56
57
from unittest import TestCase
from domain.stage import Stage
class TestStage(TestCase):
def test_stage_incomplete(self):
return {
"stage_name": "PREPARE",
"stage_order": 2.0,
"tasks": [
{
"task_name": "make_food",
"parent_task": [],
"task_type": "SERVICE",
"task_queue": "make_food_queue",
"status": "SCHEDULED",
"last_updated_time_pretty": "Fri Jun 28 10:45:42 2019"
},
{
"task_name": "assign_executive",
"parent_task": [],
"task_queue": "assign_executive_queue",
"task_type": "SERVICE",
"status": "SCHEDULED",
"last_updated_time_pretty": "Fri Jun 28 10:45:42 2019"
},
{
"task_name": "confirm_delivery",
"parent_task": [
"make_food",
"assign_executive"
],
"task_queue": "confirm_delivery_queue",
"task_type": "SERVICE",
"business_status": "FOOD ON THE WAY",
"status": "PENDING"
}
],
"status": "ACTIVE"
}
def test_all_tasks_completed(self):
test_stage = self.test_stage_incomplete()
stage_object = Stage.from_json(test_stage)
assert stage_object.all_tasks_completed() is False
def test_get_pending_tasks(self):
test_stage = self.test_stage_incomplete()
stage_object = Stage.from_json(test_stage)
pending_tasks = stage_object.get_pending_tasks()
assert pending_tasks is not None and len(pending_tasks) == 1