diff options
author | Vitaly Takmazov | 2016-07-11 13:30:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-11 13:30:37 +0300 |
commit | afadc6521ac2643a389fe11fe6b5863a0e6aa88a (patch) | |
tree | fc7c504a2af39de1848f47ee6e723c28dff1a4f0 /src/test | |
parent | d6fb4288688294d2f76325f14410db3091fea0fa (diff) |
fix protocol and tests
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/juick/tests/ApiTests.java | 6 | ||||
-rw-r--r-- | src/test/resources/schema.sql | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/test/java/com/juick/tests/ApiTests.java b/src/test/java/com/juick/tests/ApiTests.java index 5f919c76..5c6cddf3 100644 --- a/src/test/java/com/juick/tests/ApiTests.java +++ b/src/test/java/com/juick/tests/ApiTests.java @@ -95,6 +95,7 @@ public class ApiTests { String baseUri = "http://localhost/"; JuickProtocol protocol = new JuickProtocol(jdbc, baseUri); MessageSerializer json = new MessageSerializer(); + assertEquals("juick user should have uid 2", 2, UserQueries.getUIDbyName(jdbc, "juick")); int uid = UserQueries.createUser(jdbc, "me", "secret"); User user = UserQueries.getUserByUID(jdbc, uid).orElse(new User()); String expectedMessage = "New message posted"; @@ -115,8 +116,9 @@ public class ApiTests { SubscriptionsQueries.getUsersSubscribedToComments(jdbc, mid, uid).size()); assertEquals("should be subscribed", "Subscribed", protocol.getReply(readerUser, "S @" + user.getUName()).getDescription()); - /*assertEquals("number of friend users should match", 2, - UserQueries.getUserFriends(jdbc, readerUid).size());*/ + List<User> friends = UserQueries.getUserFriends(jdbc, readerUid); + assertEquals("number of friend users should match", 2, + friends.size()); assertEquals("number of reader users should match", 1, UserQueries.getUserReaders(jdbc, uid).size()); String expectedReply = "Reply posted.\n#" + mid + "/1 " diff --git a/src/test/resources/schema.sql b/src/test/resources/schema.sql index 980573ae..f312db22 100644 --- a/src/test/resources/schema.sql +++ b/src/test/resources/schema.sql @@ -274,7 +274,7 @@ CREATE TABLE `meon` ( `name` char(32) NOT NULL, `ico` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=10850 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -307,7 +307,7 @@ CREATE TABLE `messages` ( KEY `place_id` (`place_id`), KEY `popular` (`popular`), KEY `hidden` (`hidden`) -) ENGINE=InnoDB AUTO_INCREMENT=2814769 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -388,7 +388,7 @@ CREATE TABLE `places` ( `user_id` int(10) unsigned NOT NULL, `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`place_id`) -) ENGINE=MyISAM AUTO_INCREMENT=2697 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -480,7 +480,7 @@ CREATE TABLE `reader_links` ( `title` char(255) NOT NULL, `ts` datetime NOT NULL, PRIMARY KEY (`link_id`) -) ENGINE=MyISAM AUTO_INCREMENT=29932 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -495,7 +495,7 @@ CREATE TABLE `reader_rss` ( `url` char(255) NOT NULL, `lastcheck` datetime NOT NULL, PRIMARY KEY (`rss_id`) -) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -598,7 +598,7 @@ CREATE TABLE `tags` ( `stat_users` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`tag_id`), KEY `synonym_id` (`synonym_id`) -) ENGINE=MyISAM AUTO_INCREMENT=115285 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -725,7 +725,7 @@ CREATE TABLE `users` ( `karma` smallint(6) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `nick` (`nick`) -) ENGINE=InnoDB AUTO_INCREMENT=29642 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- |