8
8
DEFAULT_COMMENT_RESPONSE ,
9
9
DEFAULT_COMPLETED_ITEMS_RESPONSE ,
10
10
DEFAULT_DUE_RESPONSE ,
11
+ DEFAULT_DURATION_RESPONSE ,
11
12
DEFAULT_ITEM_COMPLETED_INFO_RESPONSE ,
12
13
DEFAULT_ITEM_RESPONSE ,
13
14
DEFAULT_LABEL_RESPONSE ,
22
23
Comment ,
23
24
CompletedItems ,
24
25
Due ,
26
+ Duration ,
25
27
Item ,
26
28
ItemCompletedInfo ,
27
29
Label ,
@@ -80,6 +82,16 @@ def test_due_from_dict():
80
82
assert due .timezone == sample_data ["timezone" ]
81
83
82
84
85
+ def test_duration_from_dict ():
86
+ sample_data = dict (DEFAULT_DURATION_RESPONSE )
87
+ sample_data .update (unexpected_data )
88
+
89
+ duration = Duration .from_dict (sample_data )
90
+
91
+ assert duration .amount == sample_data ["amount" ]
92
+ assert duration .unit == sample_data ["unit" ]
93
+
94
+
83
95
def test_task_from_dict ():
84
96
sample_data = dict (DEFAULT_TASK_RESPONSE )
85
97
sample_data .update (unexpected_data )
@@ -102,6 +114,34 @@ def test_task_from_dict():
102
114
assert task .labels == sample_data ["labels" ]
103
115
assert task .order == sample_data ["order" ]
104
116
assert task .parent_id == sample_data ["parent_id" ]
117
+ assert task .duration == Duration .from_dict (sample_data ["duration" ])
118
+
119
+
120
+ def test_task_to_dict ():
121
+ sample_data = dict (DEFAULT_TASK_RESPONSE )
122
+ sample_data .update (unexpected_data )
123
+
124
+ task = Task .from_dict (sample_data ).to_dict ()
125
+
126
+ assert task ["comment_count" ] == sample_data ["comment_count" ]
127
+ assert task ["is_completed" ] == sample_data ["is_completed" ]
128
+ assert task ["content" ] == sample_data ["content" ]
129
+ assert task ["created_at" ] == sample_data ["created_at" ]
130
+ assert task ["creator_id" ] == sample_data ["creator_id" ]
131
+ assert task ["id" ] == sample_data ["id" ]
132
+ assert task ["project_id" ] == sample_data ["project_id" ]
133
+ assert task ["section_id" ] == sample_data ["section_id" ]
134
+ assert task ["priority" ] == sample_data ["priority" ]
135
+ assert task ["url" ] == sample_data ["url" ]
136
+ assert task ["assignee_id" ] == sample_data ["assignee_id" ]
137
+ assert task ["assigner_id" ] == sample_data ["assigner_id" ]
138
+ for key in task ["due" ]:
139
+ assert task ["due" ][key ] == sample_data ["due" ][key ]
140
+ assert task ["labels" ] == sample_data ["labels" ]
141
+ assert task ["order" ] == sample_data ["order" ]
142
+ assert task ["parent_id" ] == sample_data ["parent_id" ]
143
+ for key in task ["duration" ]:
144
+ assert task ["duration" ][key ] == sample_data ["duration" ][key ]
105
145
106
146
107
147
def test_collaborator_from_dict ():
0 commit comments