Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notify/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
e-mail address to add as cc
bcc: str
e-mail address to add as bcc
files: str, list
files: str, dict
Path(s) to file(s) to add as attachment
df: pd.DataFrame
dataframe that needs to be added to the HTML message.
Expand All @@ -59,7 +59,7 @@ def __init__(
self.bcc = bcc.replace(";", ",") if bcc is not None else bcc
self.subject = subject
self.message = message
self.files = [files] if isinstance(files, str) else files
self.files = {files.split("/")[-1]: files} if isinstance(files, str) else files
self.df = df
self.graph = Graph()
self.graph.ensure_graph_for_app_only_auth()
Expand Down
16 changes: 16 additions & 0 deletions notify/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ def test_send_file():
assert response


def test_send_multiple_files():
message = "This is a test from notify for multiple files"
subject = "Test Notify multiple files"
core_file_name = "2010 car efficiency"
file_name_1 = f"{core_file_name}_1.csv"
file_name_2 = f"{core_file_name}_2.csv"
file_path = os.path.join("notify", "tests", "data", f"{core_file_name}.csv")
response = NotifyMail(
to=f"{os.environ.get('TEST_EMAIL_1')}",
subject=subject,
message=message,
files={file_name_1: file_path, file_name_2: file_path},
).send_email()
assert response.status_code == 202


def test_send_file_from_storage():
message = "This is a test from notify"
subject = "Test Notify file Azure Storage"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = zyppnotify
version = 1.0.1
version = 1.1.0
author = Zypp
author_email = hello@zypp.io
description = Send users notifications through various platforms
Expand Down
Loading