Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonjoyce committed Nov 28, 2023
1 parent ef49efe commit 9cf7bd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pyas2lib/as2.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,16 @@ def build(
self.message_id = f"{message_id}@{self.sender.domain}"
else:
self.message_id = (
email_utils.make_msgid(domain=self.sender.domain).lstrip("<").rstrip(">")
email_utils.make_msgid(domain=self.sender.domain)
.lstrip("<")
.rstrip(">")
)

# ensure the total length of the message id is no more than 255 characters
if len(self.message_id) > 255:
raise ValueError(
f"Message ID must be no more than 255 characters for compatibility with some AS2 servers. "
"Message ID must be no more than 255 characters for "
"compatibility with some AS2 servers. "
f"Current message ID length is {len(self.message_id)}."
)

Expand Down
5 changes: 4 additions & 1 deletion pyas2lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ def test_invalid_message_id_length_raises_error(self):
very_long_message_id = "a" * 1000
with pytest.raises(ValueError) as excinfo:
out_message.build(self.test_data, message_id=very_long_message_id)
assert "Message ID must be no more than 255 characters for compatibility" in str(excinfo.value)
assert (
"Message ID must be no more than 255 characters for compatibility"
in str(excinfo.value)
)

def find_org(self, as2_id):
return self.org
Expand Down

0 comments on commit 9cf7bd4

Please sign in to comment.