New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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.
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.
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.
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.
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.
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 added a commit that referenced this pull request Jan 23, 2013

Merge pull request #67 from NiKnight/master
Fixes to MailCore tests; no hard-coding of mail account data, proper test data file access

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


This comment has been minimized.


mronge commented Jan 23, 2013


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