X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/25e5ba1bdfefce82ff8e4bb0221de19a538b4d3c..8b54174e148840e1cd7412f3018cbb5b55cbb7c1:/tests/testusers.h?ds=sidebyside diff --git a/tests/testusers.h b/tests/testusers.h index bbf48063..adc0507e 100644 --- a/tests/testusers.h +++ b/tests/testusers.h @@ -1,41 +1,50 @@ -#ifndef __TEST_USERS_H__ -#define __TEST_USERS_H__ +#pragma once -class TEST_USERS : public USERS { - public: - TEST_USERS() {} +#include "stg/users.h" - int FindByName(const std::string & /*login*/, USER_PTR * /*user*/) - { return -1; } +struct TestUsers : public STG::Users +{ + TestUsers() {} - bool TariffInUse(const std::string & /*tariffName*/) const - { return -1; } + using UserPtr = STG::User*; + using ConstUserPtr = const STG::User*; - void AddNotifierUserAdd(NOTIFIER_BASE * /*notifier*/) {} - void DelNotifierUserAdd(NOTIFIER_BASE * /*notifier*/) {} + int FindByName(const std::string& /*login*/, UserPtr* /*user*/) override + { return -1; } + int FindByName(const std::string& /*login*/, ConstUserPtr* /*user*/) const override + { return -1; } - void AddNotifierUserDel(NOTIFIER_BASE * /*notifier*/) {} - void DelNotifierUserDel(NOTIFIER_BASE * /*notifier*/) {} + bool TariffInUse(const std::string& /*tariffName*/) const override + { return -1; } - int Add(const std::string & /*login*/, const ADMIN * /*admin*/) - { return 0; } - void Del(const std::string & /*login*/, const ADMIN * /*admin*/) {} + void AddNotifierUserAdd(STG::NotifierBase* /*notifier*/) override {} + void DelNotifierUserAdd(STG::NotifierBase* /*notifier*/) override {} - int ReadUsers() { return 0; } - int GetUserNum() const { return 0; } + void AddNotifierUserDel(STG::NotifierBase* /*notifier*/) override {} + void DelNotifierUserDel(STG::NotifierBase* /*notifier*/) override {} - int FindByIPIdx(uint32_t /*ip*/, USER_PTR * /*user*/) const - { return -1; } - bool IsIPInIndex(uint32_t /*ip*/) const { return false; } + int Add(const std::string& /*login*/, const STG::Admin* /*admin*/) override + { return 0; } + void Del(const std::string& /*login*/, const STG::Admin* /*admin*/) override {} - int OpenSearch() { return 0; } - int SearchNext(int /*handle*/, USER_PTR * /*u*/) { return -1; } - int CloseSearch(int /*handle*/) { return 0; } + bool Authorize(const std::string&, uint32_t, uint32_t, const STG::Auth*) override + { return false; } + bool Unauthorize(const std::string&, const STG::Auth*, const std::string&) override + { return false; } - int Start() { return 0; } - int Stop() { return 0; } + int ReadUsers() override { return 0; } + virtual size_t Count() const override { return 0; }; - private: -}; + int FindByIPIdx(uint32_t /*ip*/, UserPtr* /*user*/) const override + { return -1; } + bool IsIPInIndex(uint32_t /*ip*/) const override { return false; } + bool IsIPInUse(uint32_t, const std::string&, ConstUserPtr*) const override { return false; } + bool Exists(const std::string&) const override { return false; } + + unsigned int OpenSearch() override { return 0; } + int SearchNext(int /*handle*/, UserPtr* /*u*/) override { return -1; } + int CloseSearch(int /*handle*/) override { return 0; } -#endif + int Start() override { return 0; } + int Stop() override { return 0; } +};