Skip to content

Commit fa70a01

Browse files
committed
-
1 parent 9619c19 commit fa70a01

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

python_toolbox/monkeypatch_envelopes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@monkeypatching_tools.monkeypatch_method(envelopes.Envelope)
12-
def add_attachment_from_string(self, file_data,
12+
def add_attachment_from_string(self, file_data, file_name,
1313
mimetype='application/octet-stream'):
1414
from python_toolbox.third_party.envelopes.envelope import \
1515
MIMEBase, email_encoders, os
@@ -19,9 +19,8 @@ def add_attachment_from_string(self, file_data,
1919
part.set_payload(file_data)
2020
email_encoders.encode_base64(part)
2121

22-
part_filename = os.path.basename(self._encoded(file_path))
2322
part.add_header('Content-Disposition', 'attachment; filename="%s"'
24-
% part_filename)
23+
% file_name)
2524

2625
self._parts.append((mimetype, part))
2726

test_python_toolbox/test_cute_profile/test_cute_profile.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -254,30 +254,3 @@ def test_folder_handler():
254254
assert len(os.listdir(temp_folder)) == 2
255255

256256

257-
def test_email_handler():
258-
with temp_value_setting.TempValueSetter((cute_profile.profile_handling,
259-
'threading'), dummy_threading):
260-
f = cute_profile.profile_ready(profile_handler=temp_folder)(func)
261-
262-
f(1, 2)
263-
assert len(os.listdir(temp_folder)) == 0
264-
265-
f(1, 2)
266-
assert len(os.listdir(temp_folder)) == 0
267-
268-
f.profiling_on = True
269-
270-
f(1, 2)
271-
assert len(os.listdir(temp_folder)) == 1
272-
273-
f(1, 2)
274-
assert len(os.listdir(temp_folder)) == 1
275-
276-
f.profiling_on = True
277-
278-
f(1, 2)
279-
assert len(os.listdir(temp_folder)) == 2
280-
281-
f(1, 2)
282-
assert len(os.listdir(temp_folder)) == 2
283-

0 commit comments

Comments
 (0)