]> git.stg.codes - stg.git/blob - tests/testusers.h
Finalize transition to Boost.UnitTest.
[stg.git] / tests / testusers.h
1 #pragma once
2
3 #include "stg/users.h"
4
5 struct TestUsers : public STG::Users
6 {
7     TestUsers() {}
8
9     using UserPtr = STG::User*;
10     using ConstUserPtr = const STG::User*;
11
12     int  FindByName(const std::string& /*login*/, UserPtr* /*user*/) override
13     { return -1; }
14     int  FindByName(const std::string& /*login*/, ConstUserPtr* /*user*/) const override
15     { return -1; }
16
17     bool TariffInUse(const std::string& /*tariffName*/) const override
18     { return -1; }
19
20     void AddNotifierUserAdd(STG::NotifierBase<UserPtr>* /*notifier*/) override {}
21     void DelNotifierUserAdd(STG::NotifierBase<UserPtr>* /*notifier*/) override {}
22
23     void AddNotifierUserDel(STG::NotifierBase<UserPtr>* /*notifier*/) override {}
24     void DelNotifierUserDel(STG::NotifierBase<UserPtr>* /*notifier*/) override {}
25
26     int  Add(const std::string& /*login*/, const STG::Admin* /*admin*/) override
27     { return 0; }
28     void Del(const std::string& /*login*/, const STG::Admin* /*admin*/) override {}
29
30     bool Authorize(const std::string&, uint32_t, uint32_t, const STG::Auth*) override
31     { return false; }
32     bool Unauthorize(const std::string&, const STG::Auth*, const std::string&) override
33     { return false; }
34
35     int  ReadUsers() override { return 0; }
36     virtual size_t Count() const override { return 0; };
37
38     int  FindByIPIdx(uint32_t /*ip*/, UserPtr* /*user*/) const override
39     { return -1; }
40     bool IsIPInIndex(uint32_t /*ip*/) const override { return false; }
41     bool IsIPInUse(uint32_t, const std::string&, ConstUserPtr*) const override { return false; }
42     bool Exists(const std::string&) const override { return false; }
43
44     unsigned int  OpenSearch() override { return 0; }
45     int  SearchNext(int /*handle*/, UserPtr* /*u*/) override { return -1; }
46     int  CloseSearch(int /*handle*/) override { return 0; }
47
48     int  Start() override { return 0; }
49     int  Stop() override { return 0; }
50 };