20#include <boost/test/unit_test.hpp>
35 bool StoreSecret(
const wxString& aService,
const wxString& aKey,
const wxString& aSecret )
override
37 m_entries[aService + wxS(
"::" ) + aKey] = aSecret;
41 bool GetSecret(
const wxString& aService,
const wxString& aKey, wxString& aSecret )
const override
43 auto it = m_entries.find( aService + wxS(
"::" ) + aKey );
45 if( it == m_entries.end() )
49 return !aSecret.IsEmpty();
52 bool DeleteSecret(
const wxString& aService,
const wxString& aKey )
override
54 m_entries.erase( aService + wxS(
"::" ) + aKey );
59 std::map<wxString, wxString> m_entries;
68 auto backend = std::make_unique<MEMORY_SECRET_BACKEND>();
76 tokens.
scope = wxS(
"openid profile parts.read" );
81 std::optional<OAUTH_TOKEN_SET> loaded =
98 provider.
metadata_url = wxS(
"https://provider.example.test/.well-known/kicad-remote-provider" );
101 settings.
providers.push_back( provider );
103 const std::string dumped = nlohmann::json( settings ).dump();
105 BOOST_CHECK( dumped.find(
"access-token" ) == std::string::npos );
106 BOOST_CHECK( dumped.find(
"refresh-token" ) == std::string::npos );
107 BOOST_CHECK( dumped.find(
"id-token" ) == std::string::npos );
bool DeleteTokens(const wxString &aProviderId, const wxString &aAccountId)
std::optional< OAUTH_TOKEN_SET > LoadTokens(const wxString &aProviderId, const wxString &aAccountId) const
bool StoreTokens(const wxString &aProviderId, const wxString &aAccountId, const OAUTH_TOKEN_SET &aTokens)
wxString last_account_label
wxString last_auth_status
std::vector< REMOTE_PROVIDER_ENTRY > providers
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(StoresLoadsAndDeletesTokens)
BOOST_CHECK_EQUAL(result, "25.4")