Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Václav Kubernát <kubernat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <map> |
| 9 | #include "datastore_access.hpp" |
Václav Kubernát | 26b5608 | 2020-02-03 18:28:56 +0100 | [diff] [blame] | 10 | #include "trompeloeil_doctest.hpp" |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 11 | #include "utils.hpp" |
| 12 | |
| 13 | namespace trompeloeil { |
| 14 | template <> |
| 15 | inline void print(std::ostream& os, const leaf_data_& data) |
| 16 | { |
| 17 | os << leafDataToString(data); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | class MockDatastoreAccess : public trompeloeil::mock_interface<DatastoreAccess> { |
| 22 | IMPLEMENT_MOCK1(getItems); |
| 23 | IMPLEMENT_MOCK2(setLeaf); |
| 24 | IMPLEMENT_MOCK1(createPresenceContainer); |
| 25 | IMPLEMENT_MOCK1(deletePresenceContainer); |
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame^] | 26 | IMPLEMENT_MOCK1(createLeafListInstance); |
| 27 | IMPLEMENT_MOCK1(deleteLeafListInstance); |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 28 | IMPLEMENT_MOCK1(createListInstance); |
| 29 | IMPLEMENT_MOCK1(deleteListInstance); |
| 30 | IMPLEMENT_MOCK2(executeRpc); |
| 31 | |
| 32 | // Can't use IMPLEMENT_MOCK for private methods - IMPLEMENT_MOCK needs full visibility of the method |
| 33 | MAKE_MOCK1(listInstances, std::vector<ListInstance>(const std::string&), override); |
| 34 | |
| 35 | |
| 36 | IMPLEMENT_MOCK0(schema); |
| 37 | |
| 38 | IMPLEMENT_MOCK0(commitChanges); |
| 39 | IMPLEMENT_MOCK0(discardChanges); |
Václav Kubernát | 7160a13 | 2020-04-03 02:11:01 +0200 | [diff] [blame] | 40 | IMPLEMENT_MOCK2(copyConfig); |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | |