summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/unittests/mockDefs.h
blob: 5bb1cd5daa3be7cd88d2b876461affed0a4c3323 (plain)
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
#ifndef MOCKDEFS_H
#define MOCKDEFS_H

#include <pq-mock.h>
#include <visibility.h>
#include <dryice.h>
#include <portage.h>
#include <users.h>
#include <maintenance.h>
#include <notifications.h>
#include <mocks.h>
#include <selectcommandUtil.impl.h>

class MockMailServerImpl : public Gentoo::MockMailServer {
	public:
		void sendEmail(const Gentoo::EmailPtr & msg, const Ice::Current &) override;
		Gentoo::Emails getSentEmails(const Ice::Current &) override;

	private:
		Gentoo::Emails sentEmails;
};

class DLL_PUBLIC Service : public IceTray::DryIce, PQ::Mock {
	public:
		Service();
};

class DLL_PUBLIC Maintenance : public IceTray::DryIce, PQ::Mock {
	public:
		Maintenance();
};

class DLL_PUBLIC Mail : public IceTray::DryIce {
	public:
		Mail();
};

class DLL_PUBLIC TestClient : public IceTray::DryIceClient {
	public:
		TestClient();

		Gentoo::MaintenancePrx m;
		Gentoo::PortagePrx p;
		Gentoo::NotificationsPrx n;
		Gentoo::MailServerPrx ms;
		Gentoo::UsersPrx u;
};

#define SQL_REQUIRE_EQUAL(sql, type, expected) \
	db->select(sql)->forEachRow<type>([&expected](const auto & n) { BOOST_REQUIRE_EQUAL(expected, n); });

#endif