mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
chore: cleanup headers; hardened tests
This commit is contained in:
parent
e1abcb0f23
commit
f52c1ec3f6
@ -2,12 +2,6 @@
|
|||||||
|
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "webfuse/server.h"
|
#include "webfuse/server.h"
|
||||||
#include "webfuse/server_config.h"
|
#include "webfuse/server_config.h"
|
||||||
#include "webfuse/test_util/server.hpp"
|
#include "webfuse/test_util/server.hpp"
|
||||||
@ -31,6 +25,7 @@ using webfuse_test::ReadDir;
|
|||||||
using testing::StrEq;
|
using testing::StrEq;
|
||||||
using testing::_;
|
using testing::_;
|
||||||
using testing::AnyNumber;
|
using testing::AnyNumber;
|
||||||
|
using testing::AtMost;
|
||||||
using testing::Return;
|
using testing::Return;
|
||||||
|
|
||||||
#define TIMEOUT (std::chrono::seconds(10))
|
#define TIMEOUT (std::chrono::seconds(10))
|
||||||
@ -118,7 +113,7 @@ TEST(server, read)
|
|||||||
.WillOnce(Return("{\"handle\": 42}"));
|
.WillOnce(Return("{\"handle\": 42}"));
|
||||||
EXPECT_CALL(handler, Invoke(StrEq("read"), _)).Times(1)
|
EXPECT_CALL(handler, Invoke(StrEq("read"), _)).Times(1)
|
||||||
.WillOnce(Return("{\"data\": \"*\", \"format\": \"identity\", \"count\": 1}"));
|
.WillOnce(Return("{\"data\": \"*\", \"format\": \"identity\", \"count\": 1}"));
|
||||||
EXPECT_CALL(handler, Invoke(StrEq("close"), _)).Times(1);
|
EXPECT_CALL(handler, Invoke(StrEq("close"), _)).Times(AtMost(1));
|
||||||
WsClient client(handler, WF_PROTOCOL_NAME_PROVIDER_CLIENT);
|
WsClient client(handler, WF_PROTOCOL_NAME_PROVIDER_CLIENT);
|
||||||
|
|
||||||
auto connected = client.Connect(server.GetPort(), WF_PROTOCOL_NAME_ADAPTER_SERVER);
|
auto connected = client.Connect(server.GetPort(), WF_PROTOCOL_NAME_ADAPTER_SERVER);
|
||||||
@ -134,6 +129,7 @@ TEST(server, read)
|
|||||||
json_decref(response);
|
json_decref(response);
|
||||||
|
|
||||||
std::string base_dir = server.GetBaseDir();
|
std::string base_dir = server.GetBaseDir();
|
||||||
|
ASSERT_TRUE(File(base_dir).isDirectory());
|
||||||
File file(base_dir + "/test/a.file");
|
File file(base_dir + "/test/a.file");
|
||||||
ASSERT_TRUE(file.hasContents("*"));
|
ASSERT_TRUE(file.hasContents("*"));
|
||||||
|
|
||||||
@ -165,6 +161,7 @@ TEST(server, readdir)
|
|||||||
json_decref(response);
|
json_decref(response);
|
||||||
|
|
||||||
std::string base_dir = server.GetBaseDir();
|
std::string base_dir = server.GetBaseDir();
|
||||||
|
ASSERT_TRUE(File(base_dir).isDirectory());
|
||||||
File file(base_dir + "/test");
|
File file(base_dir + "/test");
|
||||||
ASSERT_TRUE(file.hasSubdirectory("foo"));
|
ASSERT_TRUE(file.hasSubdirectory("foo"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user