aboutsummaryrefslogtreecommitdiff
path: root/src/app_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app_test.cpp')
-rw-r--r--src/app_test.cpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/app_test.cpp b/src/app_test.cpp
index 06f2084..d1f41a5 100644
--- a/src/app_test.cpp
+++ b/src/app_test.cpp
@@ -19,46 +19,47 @@ using ::testing::HasSubstr;
19using ::testing::FieldsAre; 19using ::testing::FieldsAre;
20using ::testing::ContainsRegex; 20using ::testing::ContainsRegex;
21 21
22// class UserAppTest : public testing::Test 22class UserAppTest : public testing::Test
23// { 23{
24// protected: 24protected:
25// UserAppTest() 25 UserAppTest()
26// { 26 {
27// config.base_url = "http://localhost:8080/"; 27 config.base_url = "http://localhost:8080/";
28// config.listen_address = "localhost"; 28 config.listen_address = "localhost";
29// config.listen_port = 8080; 29 config.listen_port = 8080;
30// config.data_dir = "."; 30 config.data_dir = ".";
31 31
32// auto auth = std::make_unique<mw::AuthMock>(); 32 auto auth = std::make_unique<mw::AuthMock>();
33 33
34// mw::UserInfo expected_user; 34 mw::UserInfo expected_user;
35// expected_user.name = "mw"; 35 expected_user.name = "mw";
36// expected_user.id = "mw"; 36 expected_user.id = "mw";
37// mw::Tokens token; 37 mw::Tokens token;
38// token.access_token = "aaa"; 38 token.access_token = "aaa";
39// EXPECT_CALL(*auth, getUser(std::move(token))) 39 EXPECT_CALL(*auth, getUser(std::move(token)))
40// .Times(::testing::AtLeast(0)) 40 .Times(::testing::AtLeast(0))
41// .WillRepeatedly(Return(expected_user)); 41 .WillRepeatedly(Return(expected_user));
42// auto data = std::make_unique<DataSourceMock>(); 42 auto data = std::make_unique<DataSourceMock>();
43// data_source = data.get(); 43 data_source = data.get();
44 44
45// app = std::make_unique<App>(config, std::move(data), std::move(auth)); 45 app = std::make_unique<App>(config, std::move(data), std::move(auth));
46// } 46 }
47 47
48// Configuration config; 48 Configuration config;
49// std::unique_ptr<App> app; 49 std::unique_ptr<App> app;
50// const DataSourceMock* data_source; 50 const DataSourceMock* data_source;
51// }; 51};
52 52
53// TEST_F(UserAppTest, CanDenyAccessToLinkList) 53TEST_F(UserAppTest, CanShowItemsOfDefaultUser)
54// { 54{
55// EXPECT_TRUE(mw::isExpected(app->start())); 55 EXPECT_TRUE(mw::isExpected(app->start()));
56// { 56 {
57// mw::HTTPSession client; 57 mw::HTTPSession client;
58// ASSIGN_OR_FAIL(const mw::HTTPResponse* res, client.get( 58 ASSIGN_OR_FAIL(const mw::HTTPResponse* res, client.get(
59// mw::HTTPRequest("http://localhost:8080/_/links"))); 59 mw::HTTPRequest("http://localhost:8080/")));
60// EXPECT_EQ(res->status, 401); 60 EXPECT_EQ(res->status, 301);
61// } 61 EXPECT_EQ(res->header.at("Location"), "http://localhost:8080/mw");
62// app->stop(); 62 }
63// app->wait(); 63 app->stop();
64// } 64 app->wait();
65}