* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala, not *-test.vala. * test/testcase.vala: Renamed to test-case.vala for consistency, remove TestCase class from Gee package since that's really not true. Clean up code for consistency. * test/meson.build, test/CMakeLists.txt: Split TestCase compilation out into a separate test lib.
44 lines
3.6 KiB
Vala
44 lines
3.6 KiB
Vala
/*
|
|
* Copyright 2016 Michael Gratton <mike@vee.net>
|
|
*
|
|
* This software is licensed under the GNU Lesser General Public License
|
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
|
*/
|
|
|
|
class Geary.RFC822.Utils.Test : TestCase {
|
|
|
|
public Test() {
|
|
base("Geary.RFC822.Utils.Test");
|
|
add_test("to_preview_text", to_preview_text);
|
|
}
|
|
|
|
public void to_preview_text() throws Error {
|
|
assert(Geary.RFC822.Utils.to_preview_text(PLAIN_BODY_ENCODED, Geary.RFC822.TextFormat.PLAIN) ==
|
|
PLAIN_BODY_EXPECTED);
|
|
assert(Geary.RFC822.Utils.to_preview_text(HTML_BODY_ENCODED, Geary.RFC822.TextFormat.HTML) ==
|
|
HTML_BODY_EXPECTED);
|
|
assert(Geary.RFC822.Utils.to_preview_text(HTML_BODY_ENCODED, Geary.RFC822.TextFormat.HTML) ==
|
|
HTML_BODY_EXPECTED);
|
|
}
|
|
|
|
public static string PLAIN_BODY_ENCODED = "-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\n=============================================================================\nFreeBSD-EN-16:11.vmbus Errata Notice\n The FreeBSD Project\n\nTopic: Avoid using spin locks for channel message locks\n\nCategory: core\nModule: vmbus\nAnnounced: 2016-08-12\nCredits: Microsoft OSTC\nAffects: FreeBSD 10.3\nCorrected: 2016-06-15 09:52:01 UTC (stable/10, 10.3-STABLE)\n 2016-08-12 04:01:16 UTC (releng/10.3, 10.3-RELEASE-p7)\n\nFor general information regarding FreeBSD Errata Notices and Security\nAdvisories, including descriptions of the fields above, security\nbranches, and the following sections, please visit\n<URL:https://security.FreeBSD.org/>.\n";
|
|
public static string PLAIN_BODY_EXPECTED = "FreeBSD-EN-16:11.vmbus Errata Notice The FreeBSD Project Topic: Avoid using spin locks for channel message locks Category: core Module: vmbus Announced: 2016-08-12 Credits: Microsoft OSTC Affects: FreeBSD 10.3 Corrected: 2016-06-15 09:52:01 UTC (stable/10, 10.3-STABLE) 2016-08-12 04:01:16 UTC (releng/10.3, 10.3-RELEASE-p7) For general information regarding FreeBSD Errata Notices and Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit <URL:https://security.FreeBSD.org/>.";
|
|
|
|
public static string HTML_BODY_ENCODED = """<html><head>
|
|
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
|
|
<style>
|
|
.bodyblack { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
|
|
td { font-size: 12px; }
|
|
.footer { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
|
|
</style>
|
|
</head>
|
|
<body><table cellSpacing="0" cellPadding="0" width="450" border="0" class="bodyblack"><tr><td>
|
|
<p><br />Hi Kenneth, <br /> <br /> We xxxxx xxxx xx xxx xxx xx xxxx x xxxxxxxx xxxxxxxx.
|
|
<br /> <br /> <br /> <br />Thank you, <br /> <br />XXXXX
|
|
X XXXXXX<br /><br />You can reply directly to this message or click the following link:<br /><a href="https://app.foobar.com/xxxxxxxx752a0ab01641966deff6c48623aba">https://app.foobar.com/xxxxxxxxxxxxxxxx1641966deff6c48623aba</a><br /><br />You can change your email preferences at:<br /><a href="https://app.foobar.com/xxxxxxxxxxxxx">https://app.foobar.com/xxxxxxxxxxx</a></p></td></tr>
|
|
</table></body></html>
|
|
""";
|
|
|
|
public static string HTML_BODY_EXPECTED = "Hi Kenneth, We xxxxx xxxx xx xxx xxx xx xxxx x xxxxxxxx xxxxxxxx. Thank you, XXXXX X XXXXXX You can reply directly to this message or click the following link: https://app.foobar.com/xxxxxxxxxxxxxxxx1641966deff6c48623aba You can change your email preferences at: https://app.foobar.com/xxxxxxxxxxx";
|
|
|
|
}
|