aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index de742447..688e6148 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -891,15 +891,17 @@ public class ServerTests {
}
@Test
public void mailParserTest() throws Exception {
- String mail = "MIME-Version: 1.0\n" +
+ emailService.addEmail(ugnich.getUid(), "ugnich@example.com");
+ int mid = messagesService.createMessage(ugnich.getUid(), "text", StringUtils.EMPTY, Collections.emptyList());
+ String mail = String.format("MIME-Version: 1.0\n" +
"Received: by 10.176.0.242 with HTTP; Fri, 16 Mar 2018 05:31:50 -0700 (PDT)\n" +
- "In-Reply-To: <2891710.100@juick.com>\n" +
- "References: <2891710.0@juick.com> <2891710.100@juick.com>\n" +
+ "In-Reply-To: <%d.0@juick.com>\n" +
+ "References: <%d.0@juick.com>\n" +
"Date: Fri, 16 Mar 2018 15:31:50 +0300\n" +
- "Delivered-To: vitalyster@gmail.com\n" +
+ "Delivered-To: ugnich@example.com\n" +
"Message-ID: <CAF+0zPD_YLVgYovajLqUFwkRAgJT+FzyQ2EzikQsPKsrnfKv-Q@mail.gmail.com>\n" +
"Subject: Re: New reply to TJ\n" +
- "From: Vitaly Takmazov <vitalyster@gmail.com>\n" +
+ "From: Ugnich <ugnich@example.com>\n" +
"To: Juick <juick@juick.com>\n" +
"Content-Type: multipart/alternative; boundary=\"001a11454886e42be5056786ca70\"\n" +
"\n" +
@@ -913,9 +915,30 @@ public class ServerTests {
"\n" +
"<div dir=\"ltr\">s2313334</div>\n" +
"\n" +
- "--001a11454886e42be5056786ca70--";
+ "--001a11454886e42be5056786ca70--", mid, mid);
mockMvc.perform(post("/api/mail").with(httpBasic(juickName, juickPassword)).content(mail))
.andExpect(status().isOk());
+ String reply = "Return-Path: <ugnich@example.com>\n" +
+ "Received: from [192.168.88.140] ([91.244.168.38])\n" +
+ " by smtp.gmail.com with ESMTPSA id r84sm3970197lja.54.2019.06.20.08.39.54\n" +
+ " for <juick@juick.com>\n" +
+ " (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n" +
+ " Thu, 20 Jun 2019 08:39:54 -0700 (PDT)\n" +
+ "From: Ugnich <ugnich@example.com>\n" +
+ "Content-Type: text/plain; charset=utf-8\n" +
+ "Content-Transfer-Encoding: base64\n" +
+ "Mime-Version: 1.0 (1.0)\n" +
+ "Date: Thu, 20 Jun 2019 18:39:54 +0300\n" +
+ "Subject: Re: New reply to vt\n" +
+ "Message-Id: <40BC3538-0A0C-4BD0-8F11-5408A85CC6EF@gmail.com>\n" +
+ "References: <2945559.7@juick.com>\n" +
+ "In-Reply-To: <CAF+0zPD_YLVgYovajLqUFwkRAgJT+FzyQ2EzikQsPKsrnfKv-Q@mail.gmail.com>\n" +
+ "To: juick@juick.com\n" +
+ "X-Mailer: iPhone Mail (16F203)\n" +
+ "\n" +
+ "0J3RgyDRjdGC0L4g0L/QvtC60LAhINCU0L7Qu9Cz0L4g0LvQuCwg0YPQvNC10Y7Rh9C4IQ==";
+ mockMvc.perform(post("/api/mail").with(httpBasic(juickName, juickPassword)).content(reply))
+ .andExpect(status().isOk());
}
@Test