From 4d8842d3254886b1925015e0cd24005dd927dd2a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 10 Apr 2018 14:21:20 +0300 Subject: server: add minimal telegram test --- .../src/test/java/com/juick/server/tests/ServerTests.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'juick-server/src/test') diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 2644b49c..2c335cb2 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -23,10 +23,7 @@ import com.juick.ExternalToken; import com.juick.Message; import com.juick.Tag; import com.juick.User; -import com.juick.server.CommandsManager; -import com.juick.server.EmailManager; -import com.juick.server.XMPPConnection; -import com.juick.server.XMPPServer; +import com.juick.server.*; import com.juick.server.helpers.AnonymousUser; import com.juick.server.helpers.CommandResult; import com.juick.server.helpers.TagStats; @@ -123,6 +120,8 @@ public class ServerTests { @Inject private TelegramService telegramService; @Inject + private TelegramBotManager telegramBotManager; + @Inject private CrosspostService crosspostService; @Inject private ImagesService imagesService; @@ -744,4 +743,10 @@ public class ServerTests { mockMvc.perform(post("/like?mid=" + freefdMid + "&hash=" + freefdHash)) .andExpect(status().isForbidden()); } + @Test + public void telegramTests() { + jdbcTemplate.update("INSERT INTO telegram(user_id, tg_id) VALUES(?,1)", ugnich.getUid()); + jdbcTemplate.update("INSERT INTO telegram_chats(chat_id) VALUES(1)"); + telegramBotManager.processUpdate("{\"message\":{\"chat\":{\"id\":1},\"text\":\"yo\",\"from\":{\"id\":1,\"username\":\"teleugnich\"}}}"); + } } -- cgit v1.2.3