X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/d1ddf1df6b8987cc1be7dc96608e22998c3e9cb6..20d4dd0571e75d254444acf755a01b48a691c7c2:/tests/test_disable_session_log.cpp diff --git a/tests/test_disable_session_log.cpp b/tests/test_disable_session_log.cpp index 75e81568..449f1f78 100644 --- a/tests/test_disable_session_log.cpp +++ b/tests/test_disable_session_log.cpp @@ -1,11 +1,11 @@ #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" @@ -14,23 +14,22 @@ 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; } @@ -43,8 +42,7 @@ private: class TEST_SETTINGS_LOCAL : public TEST_SETTINGS { public: TEST_SETTINGS_LOCAL(bool _disableSessionLog) - : TEST_SETTINGS(), - disableSessionLog(_disableSessionLog) + : disableSessionLog(_disableSessionLog) {} bool GetDisableSessionLog() const { return disableSessionLog; } @@ -73,16 +71,16 @@ namespace tut 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 & ips(user.GetProperty().ips); + STG::UserProperty & 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(0)); @@ -116,16 +114,16 @@ namespace tut 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 & ips(user.GetProperty().ips); + STG::UserProperty & 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(0));