[Server] Share one in-memory database interface across the server tests (#7862)

This commit is contained in:
BruebachL 2026-11-10 12:16:35 +01:00 • committed by GitHub
parent 3a1238a467
commit 9315a4aa6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 200 additions and 170 deletions

View file

@ -7,8 +7,8 @@
#include "game/role_info.h"
#include "game/server_game.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/server/dev/servatrice_in_memory_database_interface.h"
#include "server.h"
#include "server_database_interface.h"
#include "server_room.h"
#include <QList>
@ -23,43 +23,12 @@ RNG_Abstract *rng = nullptr; // referenced by the server_remote library
namespace
{
class MockDatabaseInterface : public Server_DatabaseInterface
{
public:
AuthenticationResult checkUserPassword(Server_ProtocolHandler *,
const QString &,
const QString &,
const QString &,
QString &,
int &,
bool) override
{
return NotLoggedIn;
}
int getNextReplayId() override
{
return 1;
}
int getNextGameId() override
{
return 1;
}
int getActiveUserCount(QString) override
{
return 0;
}
ServerInfo_User getUserData(const QString &, bool) override
{
return ServerInfo_User();
}
};
class FakeServer : public Server
{
public:
FakeServer()
{
setDatabaseInterface(new MockDatabaseInterface());
setDatabaseInterface(new Servatrice_InMemoryDatabaseInterface());
}
};