#include "tut/tut.hpp"
+#include "stg/admin.h"
#include "stg/user_property.h"
#include "user_impl.h"
#include "testsettings.h"
#include "testtariffs.h"
-#include "testadmin.h"
#include "teststore.h"
#include "testauth.h"
#include "testusers.h"
namespace
{
-class TEST_STORE_LOCAL : public TEST_STORE,
- private NONCOPYABLE {
+class TEST_STORE_LOCAL : public TEST_STORE {
public:
TEST_STORE_LOCAL()
: connects(0),
disconnects(0)
{}
- int WriteUserConnect(const std::string & /*login*/, uint32_t /*ip*/) const { ++connects; return 0; }
+ int WriteUserConnect(const std::string & /*login*/, uint32_t /*ip*/) const override { ++connects; return 0; }
int WriteUserDisconnect(const std::string & /*login*/,
- const DIR_TRAFF & /*up*/,
- const DIR_TRAFF & /*down*/,
- const DIR_TRAFF & /*sessionUp*/,
- const DIR_TRAFF & /*sessionDown*/,
+ const STG::DirTraff & /*up*/,
+ const STG::DirTraff & /*down*/,
+ const STG::DirTraff & /*sessionUp*/,
+ const STG::DirTraff & /*sessionDown*/,
double /*cash*/,
double /*freeMb*/,
- const std::string & /*reason*/) const { ++disconnects; return 0; }
+ const std::string & /*reason*/) const override { ++disconnects; return 0; }
size_t GetConnects() const { return connects; }
size_t GetDisconnects() const { return disconnects; }
class TEST_SETTINGS_LOCAL : public TEST_SETTINGS {
public:
TEST_SETTINGS_LOCAL(bool _disableSessionLog)
- : TEST_SETTINGS(),
- disableSessionLog(_disableSessionLog)
+ : disableSessionLog(_disableSessionLog)
{}
bool GetDisableSessionLog() const { return disableSessionLog; }
TEST_SETTINGS_LOCAL settings(false);
TEST_TARIFFS tariffs;
- TEST_ADMIN admin;
+ STG::Admin admin(STG::Priv(0xFFFF), {}, {});
TEST_STORE_LOCAL store;
TEST_AUTH auth;
TEST_USERS users;
TEST_SERVICES services;
- USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+ STG::UserImpl user(&settings, &store, &tariffs, &admin, &users, services);
- USER_PROPERTY<USER_IPS> & ips(user.GetProperty().ips);
+ STG::UserProperty<STG::UserIPs> & ips(user.GetProperties().ips);
- ips = StrToIPS("*");
+ ips = STG::UserIPs::parse("*");
ensure_equals("user.connected = false", user.GetConnected(), false);
ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));
TEST_SETTINGS_LOCAL settings(true);
TEST_TARIFFS tariffs;
- TEST_ADMIN admin;
+ STG::Admin admin(STG::Priv(0xFFFF), {}, {});
TEST_STORE_LOCAL store;
TEST_AUTH auth;
TEST_USERS users;
TEST_SERVICES services;
- USER_IMPL user(&settings, &store, &tariffs, &admin, &users, services);
+ STG::UserImpl user(&settings, &store, &tariffs, &admin, &users, services);
- USER_PROPERTY<USER_IPS> & ips(user.GetProperty().ips);
+ STG::UserProperty<STG::UserIPs> & ips(user.GetProperties().ips);
- ips = StrToIPS("*");
+ ips = STG::UserIPs::parse("*");
ensure_equals("user.connected = false", user.GetConnected(), false);
ensure_equals("connects = 0", store.GetConnects(), static_cast<size_t>(0));