Skip to content

Update session.py methods to support simulated behaviours

Some optional parameters are needed to chose behaviours to simulate:

ProtocolFlags.REJECTED_RECIPIENTS
Add an option to allow or disallow rejected recipients.
--- a/kilter/service/session.py
+++ b/kilter/service/session.py
@@ -305,7 +305,7 @@ class Session:
-       async def envelope_recipients(self) -> AsyncIterator[str]:
+       async def envelope_recipients(self, rejected: bool = ...) -> AsyncIterator[str]:

Note: For Sendmail ≥ 8.14 or Postfix ≥ 2.6 the {rcpt_mailer} macro will have the value "error" for rejected recipients, which can be used to detect them.

ProtocolFlags.HEADER_LEADING_SPACE
Add a method to strip or include leading space in header values.
--- a/kilter/service/session.py
+++ b/kilter/service/session.py
@@ -408,6 +408,9 @@ class HeadersAccessor(AsyncContextManager["HeaderIterator"]):
+       async def raw(self) -> AsyncContextManager[HeaderIterator]: ...
ProtocolFlags.MAX_DATA_SIZE_256K and ProtocolFlags.MAX_DATA_SIZE_1M
Add a method to limit the size of message body chunks
--- a/kilter/service/session.py
+++ b/kilter/service/session.py
@@ -551,6 +554,11 @@ class BodyAccessor(AsyncContextManager[AsyncIterator[memoryview]]):
+
+       async def in_size(                                                                                                                                                                
+               self,                                                                                                                                                                     
+               size: Literal[ProtocolFlags.MDS_1M, ProtocolFlags.MDS_256K],                                                                                                              
+       ) -> AsyncContextManager[AsyncIterator[memoryview]]: ...                                                                                                                          
Edited by Dom Sekotill
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information