Patrick Rein uploaded a new version of NetworkTests to project The Trunk:
http://source.squeak.org/trunk/NetworkTests-pre.47.mcz ==================== Summary ==================== Name: NetworkTests-pre.47 Author: pre Time: 12 May 2017, 5:38:09.138874 pm UUID: 08607de4-b6f0-3d4a-b2b5-e510203fc346 Ancestors: NetworkTests-pre.46 Tests for supporting features for email handling including a message for creating a reply to a message and a rfc 822 compliant printing of DateAndTime objects =============== Diff against NetworkTests-pre.46 =============== Item was added: + TestCase subclass: #MailDateAndTimeTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'NetworkTests-RFC822'! Item was added: + ----- Method: MailDateAndTimeTest>>testBasicDate (in category 'as yet unclassified') ----- + testBasicDate + + | date | + date := DateAndTime year: 2017 month: 2 day: 3. + self assert: 'Fri, 03 Feb 2017 00:00:00 +0200' equals: date asMailMessageString! Item was added: + ----- Method: MailDateAndTimeTest>>testBasicDateAndTime (in category 'as yet unclassified') ----- + testBasicDateAndTime + + | date | + date := DateAndTime year: 2000 month: 6 day: 22 hour: 14 minute: 17 second: 47 offset: (Duration days: 0 hours: -5 minutes: 0 seconds: 0 nanoSeconds:0). + self assert: 'Thu, 22 Jun 2000 14:17:47 -0500' equals: date asMailMessageString + ! Item was added: + ----- Method: MailMessageTest>>fixtureMail (in category 'fixtures') ----- + fixtureMail + + ^ MailMessage empty + from: self fixtureSenderMail; + to: self fixtureReceiverMails; + messageId: self fixtureMessageId; + dateTime: self fixtureMessageDate; + subject: self fixtureSubject; + yourself! Item was added: + ----- Method: MailMessageTest>>fixtureMessageDate (in category 'fixtures') ----- + fixtureMessageDate + + ^ DateAndTime year: 2017 month: 2 day: 5 hour: 14 minute: 15 ! Item was added: + ----- Method: MailMessageTest>>fixtureMessageId (in category 'fixtures') ----- + fixtureMessageId + + ^ '[hidden email]'! Item was added: + ----- Method: MailMessageTest>>fixtureReceiverMails (in category 'fixtures') ----- + fixtureReceiverMails + + ^ '[hidden email]'! Item was added: + ----- Method: MailMessageTest>>fixtureSenderMail (in category 'fixtures') ----- + fixtureSenderMail + + ^ '[hidden email]'! Item was added: + ----- Method: MailMessageTest>>fixtureSubject (in category 'fixtures') ----- + fixtureSubject + + ^ 'This is the subject'! Item was added: + ----- Method: MailMessageTest>>testCreateAReplyForFrom (in category 'testing') ----- + testCreateAReplyForFrom + + | replyMail | + replyMail := MailMessage replyFor: self fixtureMail. + self assert: self fixtureSenderMail equals: replyMail to.! Item was added: + ----- Method: MailMessageTest>>testCreateAReplyForReplyTo (in category 'testing') ----- + testCreateAReplyForReplyTo + + | replyMail startMail | + startMail := self fixtureMail + setField: 'reply-to' toString: '[hidden email]'; + yourself. + replyMail := MailMessage replyFor: startMail. + self assert: '[hidden email]' equals: replyMail to.! Item was added: + ----- Method: MailMessageTest>>testCreateAReplyForReplyTos (in category 'testing') ----- + testCreateAReplyForReplyTos + + | replyMail startMail | + startMail := self fixtureMail + setField: 'reply-to' toString: '[hidden email], [hidden email]'; + yourself. + replyMail := MailMessage replyFor: startMail. + self assert: '[hidden email], [hidden email]' equals: replyMail to.! Item was added: + ----- Method: MailMessageTest>>testCreateAReplyHasANewSubject (in category 'testing') ----- + testCreateAReplyHasANewSubject + + | replyMail | + replyMail := MailMessage replyFor: self fixtureMail. + self assert: 'Re: ' , self fixtureSubject equals: replyMail subject.! Item was added: + ----- Method: MailMessageTest>>testCreateAReplyHasANewSubjectUnlessWasAlreadyReply (in category 'testing') ----- + testCreateAReplyHasANewSubjectUnlessWasAlreadyReply + + | replyMail startMail | + startMail := self fixtureMail + subject: 'Re: Subject'; + yourself. + replyMail := MailMessage replyFor: startMail. + self assert: 'Re: Subject' equals: replyMail subject.! Item was changed: + ----- Method: MailMessageTest>>testDateStampFractionalSecondFormatting (in category 'testing') ----- - ----- Method: MailMessageTest>>testDateStampFractionalSecondFormatting (in category 'as yet unclassified') ----- testDateStampFractionalSecondFormatting self assert: (MailMessage dateStamp: (DateAndTime fromSeconds: 1.234)) = 'Tue, 1 Jan 1901 00:00:01' description: 'RFC822 (and RFC2822) forbids non-integer seconds in dates'! Item was added: + ----- Method: MailMessageTest>>testReplyContainsInReplyTo (in category 'testing') ----- + testReplyContainsInReplyTo + + | replyMail | + replyMail := MailMessage replyFor: self fixtureMail. + self assert: self fixtureMessageId equals: (replyMail fieldNamed: 'in-reply-to' ifAbsent: [self fail]) mainValue.! Item was added: + ----- Method: MailMessageTest>>testReplyContainsReferences (in category 'testing') ----- + testReplyContainsReferences + + | replyMail lastReply | + replyMail := MailMessage replyFor: self fixtureMail. + replyMail + setField: 'message-id' toString: 'abc'; + from: '[hidden email]'. + lastReply := MailMessage replyFor: replyMail. + + self + assert: self fixtureMessageId , ', abc' + equals: (lastReply fieldNamed: 'references' ifAbsent: [self fail]) mainValue.! |
Free forum by Nabble | Edit this page |