rublon-ssh/PAM/ssh/tests/gtest_matchers.hpp
rublon-bwi 6b9d2f938c
Bwi/v2.1.0 (#15)
* Add phone call authentication method

* Remove dynamic mem allocation from error handler

* Add more error handling code

* Move error handling to different file

* Remove Socket IO dependency

* cleanup in websocket code

* Add rapidjson as cmake dependency

* Added Dockerfiles as primary build system for packages

* Changed policy in CMakeList to work with lower version of CMake

* Fix opensuse builds

* Link filesystem library in gcc 8.5 or older
2024-11-18 12:57:20 +01:00

38 lines
780 B
C++

#pragma once
#include <gmock/gmock.h>
#include <rublon/error.hpp>
#include <rublon/json.hpp>
using namespace testing;
inline bool operator==(const rublon::Error & lhs, const rublon::Error & rhs) {
return lhs.category() == rhs.category();
}
MATCHER(HasValue, "") {
return arg.has_value();
}
MATCHER(IsObject, "") {
return arg->IsObject();
}
MATCHER(IsPAMBaypass, "") {
return arg.error().category() == rublon::Error::k_RublonAuthenticationInterrupt;
}
MATCHER(IsPAMDeny, "") {
return arg.error().category() == rublon::Error::k_RublonAuthenticationInterrupt;
}
MATCHER_P(HasKey, key, "") {
return rublon::JSONPointer{key}.Get(arg.value()) != nullptr;
}
MATCHER_P(Unexpected, error, "") {
rublon::Error e = arg.error();
return e == error;
}