File: test_quote_html.cc

package info (click to toggle)
astroidmail 0.17%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,160 kB
  • sloc: cpp: 21,133; ansic: 1,619; python: 93; sh: 73; makefile: 7
file content (63 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# define BOOST_TEST_DYN_LINK
# define BOOST_TEST_MODULE TestCompose
# include <boost/test/unit_test.hpp>

# include "test_common.hh"
# include "message_thread.hh"
# include "utils/ustring_utils.hh"
# include "config.hh"

BOOST_AUTO_TEST_SUITE(QuoteHtml)

  BOOST_AUTO_TEST_CASE(quote_html)
  {
    using Astroid::Message;
    setup ();

    ustring fname = "tests/mail/test_mail/only-html.eml";

    Message m (fname);
    ustring quoted = m.quote ();

    LOG (trace) << "quoted plain text: " << quoted;

    Astroid::UstringUtils::trim (quoted);

    ustring target = R"(1. save an email as file.eml
 2. write a new email
 3. attach file.eml
 4. save as draft
 5. quit astroid
 6. open draft again
 7. edit the draft
 8. here it is.

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.*)";

    BOOST_CHECK (quoted == target);

    teardown ();
  }

  BOOST_AUTO_TEST_CASE(quote_html_convert_error)
  {
    using Astroid::Message;
    setup ();

    // TODO: Does not work with lynx
    /* const_cast<ptree&>(astroid->config()).put ("mail.reply.quote_processor", "lynx -dump -stdin"); */

    ustring fname = "tests/mail/test_mail/isspace-fail-utf-8.eml";

    Message m (fname);
    ustring quoted = m.quote ();

    LOG (trace) << "quoted plain text: " << quoted;

    teardown ();
  }

BOOST_AUTO_TEST_SUITE_END()