Fixes to MailCore tests; no hard-coding of mail account data, proper test data file access #67

merged 8 commits into from Jan 23, 2013


None yet
2 participants

scottnonnenberg commented Dec 21, 2012

Hey guys. I'm back with an updated and cleaner Pull Request.

Now all TestData is compiled into the Test bundle and pulled out of it when needed by the tests. The same account.plist is still recommended (and excluded by .gitignore) to specify your own mail account information for the live test.

There was one key change to the source to make the tests pass, in commit 'Fix to Core Folder tests; senderDate returns nil.' Not sure why [NSDate distantPast] was used instead of nil, but I changed it to what the test expected, nil. We can easily change that back and in the test if needed. [NSDate distantPast] just seems very weird to me.

Three tests still failing, but they seem like they might be a regression in the core functionality more than anything specific to my changes. Thoughts?

file://localhost/Users/scottnonnenberg/Development/MailCore/Tests/CTCoreAttachmentTests.m: error: testJPEG (CTCoreAttachmentTests) failed: 'image/jpeg' should be equal to 'application/octet-stream' The content-type should have been image/jpeg
file://localhost/Users/scottnonnenberg/Development/MailCore/Tests/CTCoreAttachmentTests.m: error: testPNG (CTCoreAttachmentTests) failed: 'image/png' should be equal to 'application/octet-stream' The content-type should have been image/png
file://localhost/Users/scottnonnenberg/Development/MailCore/Tests/CTCoreAttachmentTests.m: error: testTIFF (CTCoreAttachmentTests) failed: 'image/tiff' should be equal to 'application/octet-stream' The content-type should have been image/TIFF

scottnonnenberg added some commits Dec 21, 2012

@scottnonnenberg scottnonnenberg account.plist used to specify mail account data
Instead of hardcoding it. Excluded from the repository via .gitignore. Also adding TestData to the project, compiled into the Test bundle.

Pushing the iOS deployment target down to 4.3, and ensuring that all projects have the same value there.
@scottnonnenberg scottnonnenberg Fixing Core Folder tests
sentDateGMT has been removed, changing to senderDate. Also, changing from bodyPreferringPlainText to just body - the former required an out parameter that was not being provided.
@scottnonnenberg scottnonnenberg MIME/CoreAttachment tests get files from bundle
Because in the newest simulators, your current working directory is more like it is in when you're on the phone itself.

Also no need for the filePrefix var any longer.
@scottnonnenberg scottnonnenberg Core Message tests: files in bundle, testSentDate
testSentDate wasn't quite passing: sentDateGMT has been removed and the number of seconds representing the date the email was sent is not what was there before. Fixed.

Also, we needed to pull the message files out of the test bundle.
@scottnonnenberg scottnonnenberg Core Message tests whitespace b5fee7f
@scottnonnenberg scottnonnenberg Fix to Core Folder tests; senderDate returns nil
Noticed that this change was necessary to get all Core Folder tests passing. Those tests expected senderDate to return nil if there was no message loaded.
@scottnonnenberg scottnonnenberg Properly pulling MIMETests/testBruteForce files fc5c8a3
@scottnonnenberg scottnonnenberg CTCoreMessage.htmlBody now behaves like .body
It calls fetchBodyStructure if myFields or myParsedMIME is null, just like .body does. Two new tests added; the change to htmlBody is required to get them both to pass.

mronge merged commit 6a7c75b into MailCore:master Jan 23, 2013


mronge commented Jan 23, 2013


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment