|
@@ -148,6 +148,25 @@ class TestBodyMailsParts(TestStandard):
|
148
|
148
|
assert mail_parts[0] == a
|
149
|
149
|
assert mail_parts[1] == b
|
150
|
150
|
|
|
151
|
+ def test_unit__append_follow(self):
|
|
152
|
+ mail_parts = BodyMailParts()
|
|
153
|
+ mail_parts.follow = True
|
|
154
|
+ a = BodyMailPart('a', BodyMailPartType.Main)
|
|
155
|
+ mail_parts._append(a)
|
|
156
|
+ b = BodyMailPart('b', BodyMailPartType.Quote)
|
|
157
|
+ mail_parts._append(b)
|
|
158
|
+ assert len(mail_parts) == 1
|
|
159
|
+ assert mail_parts[0].part_type == BodyMailPartType.Main
|
|
160
|
+ assert mail_parts[0].text == 'ab'
|
|
161
|
+
|
|
162
|
+ def test_unit__append_dont_follow_when_first(self):
|
|
163
|
+ mail_parts = BodyMailParts()
|
|
164
|
+ a = BodyMailPart('a', BodyMailPartType.Main)
|
|
165
|
+ mail_parts._append(a,follow=True)
|
|
166
|
+ assert len(mail_parts) == 1
|
|
167
|
+ assert mail_parts[0].part_type == BodyMailPartType.Main
|
|
168
|
+ assert mail_parts[0].text == 'a'
|
|
169
|
+
|
151
|
170
|
@raises(TypeError)
|
152
|
171
|
def test_unit__check_value__type_error(self):
|
153
|
172
|
mail_parts = BodyMailParts()
|
|
@@ -174,6 +193,23 @@ class TestBodyMailsParts(TestStandard):
|
174
|
193
|
assert mail_parts[1].text == 'c'
|
175
|
194
|
assert mail_parts[1].part_type == BodyMailPartType.Signature
|
176
|
195
|
|
|
196
|
+ def test_unit__drop_part_type_verify_no_follow_incidence(self):
|
|
197
|
+ mail_parts = BodyMailParts()
|
|
198
|
+ a = BodyMailPart('a', BodyMailPartType.Main)
|
|
199
|
+ mail_parts._list.append(a)
|
|
200
|
+ b = BodyMailPart('b', BodyMailPartType.Quote)
|
|
201
|
+ mail_parts._list.append(b)
|
|
202
|
+ c = BodyMailPart('c', BodyMailPartType.Signature)
|
|
203
|
+ mail_parts._list.append(c)
|
|
204
|
+ mail_parts.follow = True
|
|
205
|
+ mail_parts.drop_part_type(BodyMailPartType.Quote)
|
|
206
|
+ assert len(mail_parts) == 2
|
|
207
|
+ assert mail_parts[0].text == 'a'
|
|
208
|
+ assert mail_parts[0].part_type == BodyMailPartType.Main
|
|
209
|
+ assert len(mail_parts) == 2
|
|
210
|
+ assert mail_parts[1].text == 'c'
|
|
211
|
+ assert mail_parts[1].part_type == BodyMailPartType.Signature
|
|
212
|
+
|
177
|
213
|
def test_unit__drop_part_type_consistence(self):
|
178
|
214
|
mail_parts = BodyMailParts()
|
179
|
215
|
a = BodyMailPart('a', BodyMailPartType.Main)
|
|
@@ -187,6 +223,7 @@ class TestBodyMailsParts(TestStandard):
|
187
|
223
|
assert mail_parts[0].text == 'ac'
|
188
|
224
|
assert mail_parts[0].part_type == BodyMailPartType.Main
|
189
|
225
|
|
|
226
|
+
|
190
|
227
|
def test_unit__get_nb_part_type(self):
|
191
|
228
|
mail_parts = BodyMailParts()
|
192
|
229
|
assert mail_parts.get_nb_part_type(BodyMailPartType.Main) == 0
|