|
@@ -187,7 +187,6 @@ def test_dict_matplotlib_no_error():
|
|
|
assert str(base64.b64encode(bytes_fig), 'ascii') == data.replace('\n', '')
|
|
assert str(base64.b64encode(bytes_fig), 'ascii') == data.replace('\n', '')
|
|
|
|
|
|
|
|
def test_dict_invalid():
|
|
def test_dict_invalid():
|
|
|
- fig, bytes_fig = get_mpl_fig()
|
|
|
|
|
|
|
|
|
|
sender = EmailSender(host=None, port=1234)
|
|
sender = EmailSender(host=None, port=1234)
|
|
|
with pytest.raises(TypeError):
|
|
with pytest.raises(TypeError):
|
|
@@ -198,6 +197,18 @@ def test_dict_invalid():
|
|
|
attachments={'myimg.png': sender}
|
|
attachments={'myimg.png': sender}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+def test_dict_invalid_key():
|
|
|
|
|
+ fig, bytes_fig = get_mpl_fig()
|
|
|
|
|
+
|
|
|
|
|
+ sender = EmailSender(host=None, port=1234)
|
|
|
|
|
+ with pytest.raises(TypeError):
|
|
|
|
|
+ msg = sender.get_message(
|
|
|
|
|
+ sender="me@gmail.com",
|
|
|
|
|
+ receivers="you@gmail.com",
|
|
|
|
|
+ subject="Some news",
|
|
|
|
|
+ attachments={sender: 'something'}
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
def test_dict_multiple(tmpdir):
|
|
def test_dict_multiple(tmpdir):
|
|
|
file1 = tmpdir.join("file_1.txt")
|
|
file1 = tmpdir.join("file_1.txt")
|
|
|
file1.write("Some content 1")
|
|
file1.write("Some content 1")
|
|
@@ -290,6 +301,17 @@ def test_list_multiple(tmpdir):
|
|
|
assert filename == expected[0]
|
|
assert filename == expected[0]
|
|
|
assert to_encoded(expected[1]) == data.replace('\n', '')
|
|
assert to_encoded(expected[1]) == data.replace('\n', '')
|
|
|
|
|
|
|
|
|
|
+def test_list_invalid():
|
|
|
|
|
+
|
|
|
|
|
+ sender = EmailSender(host=None, port=1234)
|
|
|
|
|
+ with pytest.raises(TypeError):
|
|
|
|
|
+ msg = sender.get_message(
|
|
|
|
|
+ sender="me@gmail.com",
|
|
|
|
|
+ receivers="you@gmail.com",
|
|
|
|
|
+ subject="Some news",
|
|
|
|
|
+ attachments=[sender]
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
def test_string_path(tmpdir):
|
|
def test_string_path(tmpdir):
|
|
|
file = tmpdir.join("data.txt")
|
|
file = tmpdir.join("data.txt")
|
|
|
file.write("Some content")
|
|
file.write("Some content")
|