Known subclasses: twisted.news.test.test_database.NewsShelfTests, twisted.news.test.test_database.PickleStorageTests

Tests for the moderation features of INewsStorage implementations.

Method setUp Undocumented
Method sendmail Fake of twisted.mail.smtp.sendmail which records attempts to send email and immediately pretends success.
Method getApprovedMessage Return a str containing an RFC 2822 formatted message including an Approved header indicating it has passed through moderation.
Method getUnapprovedMessage Return a str containing an RFC 2822 formatted message with no Approved header indicating it may require moderation.
Method getStorage Override in a subclass to return a INewsStorage provider to test for correct moderation behavior.
Method test_postApproved INewsStorage.postRequest posts the message if it includes an Approved header.
Method test_postModerated INewsStorage.postRequest forwards a message to the moderator if it does not include an Approved header.
Method _checkModeratorMessage Undocumented
def setUp(self):
Undocumented
def sendmail(self, smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25):

Fake of twisted.mail.smtp.sendmail which records attempts to send email and immediately pretends success.

Subclasses should arrange for their storage implementation to call this instead of the real sendmail function.

def getApprovedMessage(self, articleID, group):

Return a str containing an RFC 2822 formatted message including an Approved header indicating it has passed through moderation.

def getUnapprovedMessage(self, articleID, group):

Return a str containing an RFC 2822 formatted message with no Approved header indicating it may require moderation.

def getStorage(self, groups, moderators, mailhost, sender):

Override in a subclass to return a INewsStorage provider to test for correct moderation behavior.

ParametersgroupsA list of str naming the groups which should exist in the resulting storage object.
moderatorsA dict mapping str each group name to a list of str giving moderator email (RFC 2821) addresses.
def test_postApproved(self):

INewsStorage.postRequest posts the message if it includes an Approved header.

def test_postModerated(self):

INewsStorage.postRequest forwards a message to the moderator if it does not include an Approved header.

def _checkModeratorMessage(self, messageText, sender, moderator, group, postingText):
Undocumented
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.