mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 20:43:25 -08:00
[Server] Share one in-memory database interface across the server tests
This commit is contained in:
parent
5565f21b39
commit
1173763af4
10 changed files with 200 additions and 170 deletions
|
|
@ -6,6 +6,7 @@ cockatrice_add_test(
|
|||
LIBS
|
||||
libcockatrice_network_server_remote
|
||||
libcockatrice_rng
|
||||
libcockatrice_server_dev
|
||||
LABELS
|
||||
server
|
||||
)
|
||||
|
|
@ -18,6 +19,7 @@ cockatrice_add_test(
|
|||
LIBS
|
||||
libcockatrice_network_server_remote
|
||||
libcockatrice_rng
|
||||
libcockatrice_server_dev
|
||||
LABELS
|
||||
server
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,42 +1,11 @@
|
|||
#include "libcockatrice/server/dev/servatrice_in_memory_database_interface.h"
|
||||
#include "server.h"
|
||||
#include "server_database_interface.h"
|
||||
|
||||
class MockDatabaseInterface : public Server_DatabaseInterface
|
||||
{
|
||||
public:
|
||||
AuthenticationResult checkUserPassword(Server_ProtocolHandler *,
|
||||
const QString &,
|
||||
const QString &,
|
||||
const QString &,
|
||||
QString &,
|
||||
int &,
|
||||
bool) override
|
||||
{
|
||||
return NotLoggedIn;
|
||||
}
|
||||
ServerInfo_User getUserData(const QString &, bool) override
|
||||
{
|
||||
return ServerInfo_User();
|
||||
}
|
||||
int getNextGameId() override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int getNextReplayId() override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
int getActiveUserCount(QString) override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
class FakeServer : public Server
|
||||
{
|
||||
public:
|
||||
FakeServer()
|
||||
{
|
||||
setDatabaseInterface(new MockDatabaseInterface());
|
||||
setDatabaseInterface(new Servatrice_InMemoryDatabaseInterface());
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue