1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef MOCKDEFS_H
#define MOCKDEFS_H
#include <array>
#include <boost/test/unit_test.hpp>
#include <c++11Helpers.h>
#include <command_fwd.h>
#include <connection.h>
#include <connection_fwd.h>
#include <dryice.h>
#include <mail.h>
#include <maintenance.h>
#include <memory>
#include <mockDatabase.h>
#include <mockMailServer.h>
#include <notifications.h>
#include <portage.h>
#include <selectcommandUtil.impl.h>
#include <string_view>
#include <users.h>
#include <visibility.h>
namespace IceTray::Mime {
class TextPart;
}
namespace PQ {
class Mock;
}
class DLL_PUBLIC DbAlias {
public:
DbAlias();
virtual ~DbAlias();
};
class DLL_PUBLIC Service : public IceTray::DryIce, DB::PluginMock<PQ::Mock>, DbAlias {
public:
Service();
};
class DLL_PUBLIC Maintenance : public IceTray::DryIce, DB::PluginMock<PQ::Mock>, DbAlias {
public:
Maintenance();
};
class DLL_PUBLIC Mail : public IceTray::DryIce {
public:
Mail();
};
class DLL_PUBLIC TestClient : public IceTray::DryIceClient {
public:
TestClient();
~TestClient();
SPECIAL_MEMBERS_DELETE(TestClient);
Gentoo::MaintenancePrxPtr m;
Gentoo::PortagePrxPtr p;
Gentoo::NotificationsPtr n;
IceTray::Mail::MailServerPtr ms;
IceTray::Mail::MockMailServerPtr mms;
Gentoo::UsersPrxPtr u;
void lintable_test_files(std::string_view name, const IceTray::Mail::EmailPtr & e) const;
std::array<IceTray::Mime::TextPart *, 2> humanReadableParts(const IceTray::Mail::EmailPtr & e) const;
};
#define SQL_REQUIRE_EQUAL(sql, type, expected) \
BOOST_TEST_CONTEXT(sql) { \
sqlRequireEqual<type>(db, sql, expected); \
}
template<typename T>
void
sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected)
{
int assertedRows = 0;
db->select(sql)->forEachRow<T>([expected, &assertedRows](const auto & n) {
BOOST_REQUIRE_EQUAL(expected, n);
assertedRows += 1;
});
BOOST_REQUIRE_EQUAL(assertedRows, 1);
}
#endif
|